LDMX Software
|
Class encapsulating parameters for configuring a processor. More...
#include <Parameters.h>
Public Member Functions | |
template<typename T > | |
void | add (const std::string &name, const T &value) |
Add a parameter to the parameter list. | |
template<typename T > | |
void | addParameter (const std::string &name, const T &value) |
bool | exists (const std::string &name) const |
Check to see if a parameter exists. | |
template<typename T > | |
const T & | get (const std::string &name) const |
Retrieve the parameter of the given name. | |
template<typename T > | |
const T & | getParameter (const std::string &name) const |
template<typename T > | |
const T & | get (const std::string &name, const T &def) const |
Retrieve a parameter with a default specified. | |
template<typename T > | |
const T & | getParameter (const std::string &name, const T &def) const |
std::vector< std::string > | keys () const |
Get a list of the keys available. | |
Private Attributes | |
std::map< std::string, std::any > | parameters_ |
container holding parameter names and their values | |
Class encapsulating parameters for configuring a processor.
The storage of arbitrary parameters recursively is done using a map from parameter names (std::string) to parameter values. The values are stored in std::any which allows the user to store any object they wish in a memory-safe environment.
Definition at line 29 of file Parameters.h.
|
inline |
Add a parameter to the parameter list.
If the parameter already exists in the list, throw an exception.
[in] | name | Name of the parameter. |
[in] | value | The value of the parameter. |
T | type of parameter being added |
Exception | if a parameter by that name already exist in the list. |
Definition at line 42 of file Parameters.h.
References exists(), and parameters_.
Referenced by framework::config::getMembers().
|
inline |
Definition at line 53 of file Parameters.h.
|
inline |
Check to see if a parameter exists.
[in] | name | name of parameter to check |
Definition at line 63 of file Parameters.h.
References parameters_.
Referenced by add(), get(), get(), and hcal::HcalGeometryProvider::getCondition().
|
inline |
Retrieve the parameter of the given name.
Exception | if parameter of the given name isn't found |
Exception | if parameter is found but not of the input type |
T | the data type to cast the parameter to. |
[in] | name | the name of the parameter value to retrieve. |
Definition at line 78 of file Parameters.h.
References exists(), and parameters_.
Referenced by get().
|
inline |
Retrieve a parameter with a default specified.
Return the input default if a parameter is not found in map.
T | type of parameter to return |
[in] | name | parameter name to retrieve |
[in,out] | def | default to use if parameter is not found |
Definition at line 114 of file Parameters.h.
|
inline |
Definition at line 99 of file Parameters.h.
|
inline |
Definition at line 122 of file Parameters.h.
|
inline |
Get a list of the keys available.
This may be helpful in debugging to make sure the parameters are spelled correctly.
Definition at line 134 of file Parameters.h.
References parameters_.
Referenced by hcal::HcalGeometryProvider::getCondition().
|
private |