EventAnalysis
1.3.0
|
Interface for a configurable class. More...
#include <Configurable.h>
Classes | |
class | Representation |
Public Member Functions | |
Configurable () | |
Constructor. More... | |
template<typename T > | |
bool | SetParameter (const std::string &name, const T &value) |
Set the value of a parameter. More... | |
bool | SetParameter (const std::string &name, const char *value) |
Set the value of a string parameter using a string literal. More... | |
std::vector< std::string > | GetParameters () |
Get the names of the parameters. More... | |
Protected Member Functions | |
template<typename T > | |
bool | DefineParameter (const std::string &name, T &variable) |
Set a parameter. More... | |
Configurable (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
Private Attributes | |
std::shared_ptr< Representation > | _repr |
Interface for a configurable class.
This class provides the interface for defining a map between names (strings) and actual variables, and for setting values of the variables via their names. Children classes can expose their internal variables with _DefineParameters, and users can set these values by calling #SetValue.
EA::Configurable::Configurable | ( | ) |
Constructor.
|
inlineprotected |
|
protected |
Set a parameter.
This method associates a name with a variable, making it possible to set its value by means of SetValue.
name | The name of the parameter. |
variable | The variable that will store the parameter value. |
std::vector< std::string > EA::Configurable::GetParameters | ( | ) |
Get the names of the parameters.
|
inlineprotected |
bool EA::Configurable::SetParameter | ( | const std::string & | name, |
const T & | value | ||
) |
Set the value of a parameter.
The method sets the value for a parameter previously defined by #_DefineParameter.
name | The name of the parameter. |
value | The new value for the parameter. |
bool EA::Configurable::SetParameter | ( | const std::string & | name, |
const char * | value | ||
) |
Set the value of a string parameter using a string literal.
Overload of template SetValue for setting the value of an std::string parameter using a const char* string literal (needed to circumvent troubles with template substitution and type mismatch).
name | The name of the parameter. |
value | The new value for the parameter. |
|
private |