Belle II Software light-2406-ragdoll
|
The Module parameter list class. More...
#include <ModuleParamList.h>
Public Member Functions | |
ModuleParamList () | |
Constructor. | |
~ModuleParamList () | |
Destructor. | |
template<typename T > | |
void | addParameter (const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue) |
Adds a new parameter to the module list. | |
template<typename T > | |
void | addParameter (const std::string &name, T ¶mVariable, const std::string &description) |
Adds a new enforced parameter to the module list. | |
template<typename T > | |
void | setParameter (const std::string &name, const T &value) |
Sets the value of a parameter given by its name. | |
void | setParameters (const ModuleParamList ¶ms) |
Set values for parameters from other parameter list. | |
std::vector< std::string > | getParameterNames () const |
Returns the names of all parameters in this parameter list. | |
std::string | getParameterDescription (const std::string &name) const |
Returns the description of a parameter given by its name. | |
std::string | getParameterTypeInfo (const std::string &name) const |
Returns the type info of a parameter given by its name. | |
template<typename T > | |
ModuleParam< T > & | getParameter (const std::string &name) const |
Returns a reference to a parameter. | |
std::vector< std::string > | getUnsetForcedParams () const |
Returns list of unset parameters (if they are required to have a value. | |
std::shared_ptr< boost::python::list > | getParamInfoListPython () const |
Returns a python list of all parameters. | |
template<typename PythonObject > | |
void | setParamPython (const std::string &name, const PythonObject &pyObj) |
Implements a method for setting boost::python objects. | |
template<typename PythonObject > | |
void | getParamValuesPython (const std::string &name, PythonObject &pyOutput, bool defaultValues) const |
Returns a python object containing the value or default value of the given parameter. | |
Private Member Functions | |
ModuleParamPtr | getParameterPtr (const std::string &name) const |
Returns a ModuleParamPtr to a parameter. | |
Static Private Member Functions | |
static void | throwNotFoundError (const std::string &name) |
Throws an error for a requested parameter that does not exist. | |
static void | throwTypeError (const std::string &name, const std::string &expectedTypeInfo, const std::string &typeInfo) |
Throws an error for a requested parameter that exists but was request with the wrong type. | |
Private Attributes | |
std::map< std::string, ModuleParamPtr > | m_paramMap |
Stores the module parameters together with a string name as key. | |
The Module parameter list class.
Stores and manages all parameters of a module.
Definition at line 44 of file ModuleParamList.h.
~ModuleParamList | ( | ) |
Destructor.
Definition at line 48 of file ModuleParamList.cc.
std::string getParameterDescription | ( | const std::string & | name | ) | const |
Returns the description of a parameter given by its name.
Throws an exception of type ModuleParameterNotFoundError if a parameter with the given name does not exist.
name | The unique name of the parameter. |
Definition at line 105 of file ModuleParamList.cc.
std::vector< std::string > getParameterNames | ( | ) | const |
Returns the names of all parameters in this parameter list.
Definition at line 95 of file ModuleParamList.cc.
|
private |
Returns a ModuleParamPtr to a parameter.
Throws an exception of type ModuleParameterNotFoundError if a parameter with the given name does not exist.
name | The unique name of the parameter. |
Definition at line 124 of file ModuleParamList.cc.
std::string getParameterTypeInfo | ( | const std::string & | name | ) | const |
Returns the type info of a parameter given by its name.
Throws an exception of type ModuleParameterNotFoundError if a parameter with the given name does not exist.
name | The unique name of the parameter. |
Definition at line 110 of file ModuleParamList.cc.
std::shared_ptr< boost::python::list > getParamInfoListPython | ( | ) | const |
Returns a python list of all parameters.
Each item in the list consists of the name of the parameter, a string describing its type, a python list of all values, a python list of all default values, the information of the parameter was set in the steering file and the description of the parameter.
Definition at line 64 of file ModuleParamList.cc.
std::vector< std::string > getUnsetForcedParams | ( | ) | const |
Returns list of unset parameters (if they are required to have a value.
Definition at line 54 of file ModuleParamList.cc.
void setParameters | ( | const ModuleParamList & | params | ) |
Set values for parameters from other parameter list.
Definition at line 86 of file ModuleParamList.cc.
|
staticprivate |
Throws an error for a requested parameter that does not exist.
name | The name of the parameter. |
Definition at line 33 of file ModuleParamList.cc.
|
staticprivate |
Throws an error for a requested parameter that exists but was request with the wrong type.
name | The name of the parameter. |
expectedTypeInfo | Type information which the parameter actually has. |
typeInfo | Type information with which the parameter was looked up. |
Definition at line 38 of file ModuleParamList.cc.
|
private |
Stores the module parameters together with a string name as key.
Definition at line 214 of file ModuleParamList.h.