Essentia
2.1-beta6-dev
|
#include <configurable.h>
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 ¶ms) |
virtual void | configure (const ParameterMap ¶ms) |
virtual void | configure () |
const ParameterMap & | defaultParameters () const |
const Parameter & | parameter (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 |
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.
|
inlinevirtual |
|
inlinevirtual |
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 >.
|
virtual |
Set the given parameters as the current ones and reconfigure the object.
Reimplemented in StreamingAlgorithmWrapper.
Referenced by StreamingAlgorithmWrapper::configure().
|
protected |
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().
|
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().
|
inline |
Return a map filled with the parameters that have been declared, along with their default value if defined.
Referenced by StreamingAlgorithmWrapper::declareParameters().
|
inline |
Return the name of this Configurable.
Referenced by Copy< TokenType >::Copy(), AlgorithmComposite::declareInput(), AlgorithmComposite::declareOutput(), DevNull< TokenType >::DevNull(), InputBase::fullName(), OutputBase::fullName(), essentia::scheduler::getIdentityAndName(), and StreamingAlgorithmWrapper::reset().
|
inline |
Returns the parameter corresponding to the given name.
Referenced by FileOutput< TokenType, StorageType >::configure().
|
inline |
Set the name for this Configurable.
Referenced by Copy< TokenType >::Copy(), DevNull< TokenType >::DevNull(), FileOutput< TokenType, StorageType >::FileOutput(), PoolStorage< TokenType, StorageType >::PoolStorage(), VectorInput< TokenType, acquireSize >::VectorInput(), and VectorOutput< TokenType, StorageType >::VectorOutput().
|
virtual |
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().
|
protected |
Referenced by StreamingAlgorithmWrapper::declareParameters().
|
protected |
Referenced by Copy< TokenType >::Copy(), DevNull< TokenType >::DevNull(), and DiskWriter< T >::DiskWriter().
|
protected |
Referenced by StreamingAlgorithmWrapper::declareParameters().
DescriptionMap parameterDescription |
Referenced by StreamingAlgorithmWrapper::declareParameters().
DescriptionMap parameterRange |
Referenced by StreamingAlgorithmWrapper::declareParameters().