EventAnalysis  1.3.0
Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
EA::Configurable Class Reference

Interface for a configurable class. More...

#include <Configurable.h>

Inheritance diagram for EA::Configurable:
EA::Algorithm EA::DataProvider EA::EventLoop EA::PersistenceService EA::AlgoSequence EA::PersistenceAlgo EA::RootDataProvider EA::RootDataProviderV0 EA::RootPersistenceService EA::AlgoSequenceDecorator EA::GarbageCollectorDecorator

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Configurable() [1/2]

EA::Configurable::Configurable ( )

Constructor.

◆ Configurable() [2/2]

EA::Configurable::Configurable ( const std::shared_ptr< Representation > &  impl)
inlineprotected

Member Function Documentation

◆ DefineParameter()

template<typename T >
bool EA::Configurable::DefineParameter ( const std::string &  name,
T &  variable 
)
protected

Set a parameter.

This method associates a name with a variable, making it possible to set its value by means of SetValue.

Parameters
nameThe name of the parameter.
variableThe variable that will store the parameter value.
Returns
true if the parameter has bee correctly defined.

◆ GetParameters()

std::vector< std::string > EA::Configurable::GetParameters ( )

Get the names of the parameters.

Returns
A vector containing the names of the parameters.

◆ GetRepresentation()

std::shared_ptr<Representation>& EA::Configurable::GetRepresentation ( )
inlineprotected

◆ SetParameter() [1/2]

template<typename T >
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.

Parameters
nameThe name of the parameter.
valueThe new value for the parameter.
Returns
true if the new value has been correctly set.

◆ SetParameter() [2/2]

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).

Parameters
nameThe name of the parameter.
valueThe new value for the parameter.
Returns
true if the new value has been correctly set.

Member Data Documentation

◆ _repr

std::shared_ptr<Representation> EA::Configurable::_repr
private

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