MarlinMT
0.1.0
|
Configurable class Interface for configuring components in the framework. More...
#include <Parameter.h>
Inherited by marlinmt::Component.
Public Types | |
using | ParameterMap = std::map< std::string, std::shared_ptr< ParameterImpl > > |
using | iterator = ParameterMap::iterator |
using | const_iterator = ParameterMap::const_iterator |
Public Member Functions | |
Configurable ()=default | |
virtual | ~Configurable ()=default |
template<typename T > | |
std::shared_ptr< ParameterImpl > | addParameter (EParameterType paramType, const std::string &name, const std::string &desc, std::shared_ptr< T > value) |
Add a parameter. More... | |
template<typename T > | |
std::shared_ptr< ParameterImpl > | addParameter (EParameterType paramType, const std::string &name, const std::string &desc, std::shared_ptr< T > value, T defVal) |
Add a parameter. More... | |
template<typename T > | |
T | parameter (const std::string &name) const |
Get a parameter value. More... | |
template<typename T > | |
T | parameter (const std::string &name, const T &fallback) const |
Get a parameter value. More... | |
void | checkParameter (const std::string &name) const |
Check if the parameter has been registered. More... | |
bool | exists (const std::string &name) const |
Return true if the parameter has been registered. More... | |
bool | isSet (const std::string &name) const |
Returns true if the parameter exists and is set, false otherwise. More... | |
void | clear () |
Remove all parameters. More... | |
void | unset () |
Unset all registered parameters. More... | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
Protected Attributes | |
ParameterMap | _parameters {} |
The parameter map. More... | |
Configurable class Interface for configuring components in the framework.
Definition at line 312 of file Parameter.h.
using marlinmt::Configurable::const_iterator = ParameterMap::const_iterator |
Definition at line 319 of file Parameter.h.
using marlinmt::Configurable::iterator = ParameterMap::iterator |
Definition at line 318 of file Parameter.h.
using marlinmt::Configurable::ParameterMap = std::map<std::string, std::shared_ptr<ParameterImpl> > |
Definition at line 317 of file Parameter.h.
|
default |
|
virtualdefault |
|
inline |
Add a parameter.
Throw if already exists.
paramType | the parameter type |
name | the parameter name |
desc | the parameter description |
value | the address to the parameter value |
Definition at line 330 of file Parameter.h.
References marlinmt::book::Flags::value().
Referenced by marlinmt::ParameterBase< bool >::ParameterBase().
|
inline |
Add a parameter.
Throw if already exists.
paramType | the parameter type |
name | the parameter name |
desc | the parameter description |
value | the address to the parameter value |
defVal | the default parameter value |
Definition at line 347 of file Parameter.h.
References marlinmt::book::Flags::value().
Configurable::iterator marlinmt::Configurable::begin | ( | ) |
Definition at line 113 of file Parameter.cc.
Configurable::const_iterator marlinmt::Configurable::begin | ( | ) | const |
Definition at line 119 of file Parameter.cc.
void marlinmt::Configurable::checkParameter | ( | const std::string & | name | ) | const |
Check if the parameter has been registered.
name | the parameter name to check |
Definition at line 77 of file Parameter.cc.
References MARLINMT_THROW.
void marlinmt::Configurable::clear | ( | ) |
Remove all parameters.
Definition at line 101 of file Parameter.cc.
Configurable::iterator marlinmt::Configurable::end | ( | ) |
Definition at line 125 of file Parameter.cc.
Configurable::const_iterator marlinmt::Configurable::end | ( | ) | const |
Definition at line 131 of file Parameter.cc.
bool marlinmt::Configurable::exists | ( | const std::string & | name | ) | const |
Return true if the parameter has been registered.
name | the parameter name to check |
Definition at line 85 of file Parameter.cc.
bool marlinmt::Configurable::isSet | ( | const std::string & | name | ) | const |
Returns true if the parameter exists and is set, false otherwise.
name | the parameter name to check |
Definition at line 91 of file Parameter.cc.
|
inline |
Get a parameter value.
name | the parameter name to get |
Definition at line 360 of file Parameter.h.
|
inline |
Get a parameter value.
Returns the fallback value if the parameter is not set. Throw an exception if the parameter is not registered
name | the parameter name |
fallback | the fallback value if the parameter is not set |
Definition at line 373 of file Parameter.h.
void marlinmt::Configurable::unset | ( | ) |
Unset all registered parameters.
Definition at line 107 of file Parameter.cc.
|
protected |
The parameter map.
Definition at line 416 of file Parameter.h.
Referenced by marlinmt::Component::getParameters(), marlinmt::Component::printParameters(), and marlinmt::Component::setParameters().