Empirical
Public Member Functions | Protected Attributes | List of all members
emp::ConfigEntry Class Referenceabstract

Base class for all configuration settings. More...

#include <config.h>

Inheritance diagram for emp::ConfigEntry:
emp::Config::ConfigLiveEntry emp::Config::tConfigConstEntry< VAR_TYPE > emp::Config::tConfigEntry< VAR_TYPE >

Public Member Functions

 ConfigEntry (const std::string _name, const std::string _type, const std::string _d_val, const std::string _desc)
 
virtual ~ConfigEntry ()
 
const std::string & GetName () const
 
const std::string & GetType () const
 
const std::string & GetDefault () const
 
const std::string & GetDescription () const
 
ConfigEntrySetName (const std::string &_in)
 
ConfigEntrySetType (const std::string &_in)
 
ConfigEntrySetDefault (const std::string &_in)
 
ConfigEntrySetDescription (const std::string &_in)
 
ConfigEntryAddAlias (const std::string &_in)
 Alert this setting that it is aliased to alternate possible names. More...
 
bool HasAlias (const std::string &_in)
 Are there any alternate names for this setting? More...
 
bool IsMatch (const std::string &_in)
 Will the provided name match this setting? More...
 
const std::unordered_set< std::string > & GetAliases ()
 Retrieve the full set of aliases. More...
 
virtual std::string GetValue () const =0
 Retrieve the value of this setting as a string. More...
 
virtual std::string GetLiteralValue () const =0
 Conver the value of this setting into a literal that C++ would recognize as its current value. More...
 
virtual ConfigEntrySetValue (const std::string &in_val, std::stringstream &warnings)=0
 Use a string to set the value of this setting. More...
 
virtual bool IsConst () const =0
 Identify if this setting is fixed at compile time. More...
 

Protected Attributes

std::string name
 
std::string type
 
std::string default_val
 
std::string desc
 
std::unordered_set< std::string > alias_set
 

Detailed Description

Base class for all configuration settings.

Constructor & Destructor Documentation

emp::ConfigEntry::ConfigEntry ( const std::string  _name,
const std::string  _type,
const std::string  _d_val,
const std::string  _desc 
)
inline
virtual emp::ConfigEntry::~ConfigEntry ( )
inlinevirtual

Member Function Documentation

ConfigEntry& emp::ConfigEntry::AddAlias ( const std::string &  _in)
inline

Alert this setting that it is aliased to alternate possible names.

const std::unordered_set<std::string>& emp::ConfigEntry::GetAliases ( )
inline

Retrieve the full set of aliases.

const std::string& emp::ConfigEntry::GetDefault ( ) const
inline
const std::string& emp::ConfigEntry::GetDescription ( ) const
inline
virtual std::string emp::ConfigEntry::GetLiteralValue ( ) const
pure virtual

Conver the value of this setting into a literal that C++ would recognize as its current value.

Implemented in emp::Config::ConfigLiveEntry, emp::Config::tConfigConstEntry< VAR_TYPE >, and emp::Config::tConfigEntry< VAR_TYPE >.

const std::string& emp::ConfigEntry::GetName ( ) const
inline
const std::string& emp::ConfigEntry::GetType ( ) const
inline
virtual std::string emp::ConfigEntry::GetValue ( ) const
pure virtual

Retrieve the value of this setting as a string.

Implemented in emp::Config::ConfigLiveEntry, emp::Config::tConfigConstEntry< VAR_TYPE >, and emp::Config::tConfigEntry< VAR_TYPE >.

bool emp::ConfigEntry::HasAlias ( const std::string &  _in)
inline

Are there any alternate names for this setting?

virtual bool emp::ConfigEntry::IsConst ( ) const
pure virtual

Identify if this setting is fixed at compile time.

Implemented in emp::Config::ConfigLiveEntry, emp::Config::tConfigConstEntry< VAR_TYPE >, and emp::Config::tConfigEntry< VAR_TYPE >.

bool emp::ConfigEntry::IsMatch ( const std::string &  _in)
inline

Will the provided name match this setting?

ConfigEntry& emp::ConfigEntry::SetDefault ( const std::string &  _in)
inline
ConfigEntry& emp::ConfigEntry::SetDescription ( const std::string &  _in)
inline
ConfigEntry& emp::ConfigEntry::SetName ( const std::string &  _in)
inline
ConfigEntry& emp::ConfigEntry::SetType ( const std::string &  _in)
inline
virtual ConfigEntry& emp::ConfigEntry::SetValue ( const std::string &  in_val,
std::stringstream &  warnings 
)
pure virtual

Use a string to set the value of this setting.

Implemented in emp::Config::ConfigLiveEntry, emp::Config::tConfigConstEntry< VAR_TYPE >, and emp::Config::tConfigEntry< VAR_TYPE >.

Member Data Documentation

std::unordered_set<std::string> emp::ConfigEntry::alias_set
protected
std::string emp::ConfigEntry::default_val
protected
std::string emp::ConfigEntry::desc
protected
std::string emp::ConfigEntry::name
protected
std::string emp::ConfigEntry::type
protected

The documentation for this class was generated from the following file: