Essentia  2.1-beta6-dev
Configurable Class Referenceabstract

#include <configurable.h>

Inheritance diagram for Configurable:
Algorithm Algorithm AccumulatorAlgorithm AlgorithmComposite Copy< TokenType > DevNull< TokenType > DiskWriter< T > FileOutput< TokenType, StorageType > PoolStorageBase RingBufferInput RingBufferOutput RingBufferVectorOutput StreamingAlgorithmWrapper VectorInput< TokenType, acquireSize > VectorOutput< TokenType, StorageType >

Public Member Functions

virtual ~Configurable ()
const std::string & name () const
void setName (const std::string &name)
virtual void declareParameters ()=0
virtual void setParameters (const ParameterMap &params)
virtual void configure (const ParameterMap &params)
virtual void configure ()
const ParameterMapdefaultParameters () const
const Parameterparameter (const std::string &key) const

Public Attributes

DescriptionMap parameterDescription
DescriptionMap parameterRange

Protected Member Functions

void declareParameter (const std::string &name, const std::string &desc, const std::string &range, const Parameter &defaultValue)

Protected Attributes

std::string _name
ParameterMap _params
ParameterMap _defaultParams

Detailed Description

A Configurable instance is an object that has a given name, and can be configured using a certain number of Parameters. These parameters have to be declared beforehand using the declareParameters method.

Whenever a Configurable instance gets reconfigured with new parameters, it will first save them internally and then call the configure() method. You should reimplement this method and do anything necessary for your object to be up-to-date and synchronized with the new parameters. These are accessible using the parameter() method.

Constructor & Destructor Documentation

◆ ~Configurable()

virtual ~Configurable ( )

Member Function Documentation

◆ configure() [1/2]

virtual void configure ( )

This function will be automatically called after some parameters have been set. This is the place where you should write your specific code which needs to be called when configuring this object.

You can access the newly set parameters using the parameter() method.

Reimplemented in StreamingAlgorithmWrapper, RingBufferVectorOutput, RingBufferOutput, RingBufferInput, and FileOutput< TokenType, StorageType >.

◆ configure() [2/2]

virtual void configure ( const ParameterMap params)

Set the given parameters as the current ones and reconfigure the object.

See also

Reimplemented in StreamingAlgorithmWrapper.

Referenced by StreamingAlgorithmWrapper::configure().

◆ declareParameter()

void declareParameter ( const std::string &  name,
const std::string &  desc,
const std::string &  range,
const Parameter defaultValue 

Use this method to declare the list of parameters that this algorithm in the declareParameters() method. If a Parameter doesn't have a default value, use its type instead, e.g.: Parameter::STRING, or Parameter::VECTOR_REAL, etc...

Referenced by FileOutput< TokenType, StorageType >::declareParameters(), RingBufferInput::declareParameters(), RingBufferOutput::declareParameters(), and RingBufferVectorOutput::declareParameters().

◆ declareParameters()

virtual void declareParameters ( )
pure virtual

Declare the parameters that this Configurable can accept. You have to implement this method in derived classes, even though you don't need any parameters. In that case, just define it as empty.

In this method you should only be calling the declareParameter method, once for each parameter, with optional default values.

Implemented in StreamingAlgorithmWrapper, VectorOutput< TokenType, StorageType >, VectorInput< TokenType, acquireSize >, RingBufferVectorOutput, RingBufferOutput, RingBufferInput, PoolStorage< TokenType, StorageType >, FileOutput< TokenType, StorageType >, DiskWriter< T >, DevNull< TokenType >, and Copy< TokenType >.

Referenced by StreamingAlgorithmWrapper::declareParameters().

◆ defaultParameters()

const ParameterMap& defaultParameters ( ) const

Return a map filled with the parameters that have been declared, along with their default value if defined.

Referenced by StreamingAlgorithmWrapper::declareParameters().

◆ name()

◆ parameter()

const Parameter& parameter ( const std::string &  key) const

Returns the parameter corresponding to the given name.

Referenced by FileOutput< TokenType, StorageType >::configure().

◆ setName()

◆ setParameters()

virtual void setParameters ( const ParameterMap params)

Set the given parameters as the current ones. Parameters which are not redefined will keep their old values, while this method will throw an EssentiaException if passing it an unknown parameter (i.e.: not declared using declareParameters() ). As a general rule, it is better to use the configure(const ParameterMap&) method, but in certain cases you may want to set parameters without reconfiguring the object.

Reimplemented in StreamingAlgorithmWrapper.

Referenced by StreamingAlgorithmWrapper::setParameters().

Member Data Documentation

◆ _defaultParams

ParameterMap _defaultParams

◆ _name

◆ _params

◆ parameterDescription

◆ parameterRange

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