![]() |
ATLAS Offline Software
|
Hold the configuration information for the whole run. More...
#include <ConfigurationSettings.h>
Public Member Functions | |
const std::string & | value (const std::string &key) const |
The user wants to know the value for the specified key. More... | |
void | retrieve (std::string const &key, bool &value) const |
The user wants to know the boolean value for the specified key. More... | |
bool | retrieve (std::string const &key) const |
same as above, but directly returning the boolean More... | |
bool | configured () const |
Have the configuration settings been read from a file? More... | |
void | loadFromFile (const std::string &filename) |
Read the settings from a text file given by. More... | |
void | checkSettings () |
Validate that configured options make sense. More... | |
const std::map< std::string, StringData > & | stringData () const |
All the user input that is stored as strings. More... | |
const std::vector< SelectionConfigurationData > | selections () const |
Get all the data needed to configure the selections. More... | |
void | registerParameter (const std::string &name, const std::string &message, const std::string &default_val="", const std::vector< std::string > allowed_values={}) |
Add a variable to the configuration settings. More... | |
bool | feature (std::string const &name) const |
test whether an (experimental) feature should be enabled More... | |
Static Public Member Functions | |
static ConfigurationSettings * | get (bool reset=false) |
Design patterns 101. More... | |
Private Member Functions | |
ConfigurationSettings () | |
private constructor More... | |
ConfigurationSettings (const ConfigurationSettings &) | |
Here but not implemented, resulting in a happy compile error if you try and use them. More... | |
ConfigurationSettings | operator= (const ConfigurationSettings &) |
Here but not implemented, resulting in a happy compile error if you try and use them. More... | |
Private Attributes | |
bool | m_configured |
True if the class has read the settings from a file or something. More... | |
std::map< std::string, StringData > | strings_ |
Hold the configuration data. More... | |
std::vector< SelectionConfigurationData > | m_selections |
Data used when configuring the selections. More... | |
std::vector< std::string > | m_killedFeatures |
Kill-switch for experimental features. More... | |
Static Private Attributes | |
static ConfigurationSettings * | m_instance = 0 |
Singletons: Good or bad, you decide. // John says they are bad. More... | |
Hold the configuration information for the whole run.
A singleton, so only one of these exists. It needs populating with a call to loadFromFile early on. Otherwise it'll be full of rubbish and will refuse to run properly
Definition at line 21 of file ConfigurationSettings.h.
|
private |
private constructor
Definition at line 24 of file ConfigurationSettings.cxx.
|
private |
Here but not implemented, resulting in a happy compile error if you try and use them.
void top::ConfigurationSettings::checkSettings | ( | ) |
Validate that configured options make sense.
This involves checking if unsupported options are not specified.
Definition at line 942 of file ConfigurationSettings.cxx.
bool top::ConfigurationSettings::configured | ( | ) | const |
Have the configuration settings been read from a file?
Definition at line 993 of file ConfigurationSettings.cxx.
bool top::ConfigurationSettings::feature | ( | std::string const & | name | ) | const |
test whether an (experimental) feature should be enabled
Note: It's not a particularly cheap operation, so avoid it in loops.
Definition at line 1033 of file ConfigurationSettings.cxx.
|
static |
Design patterns 101.
A singleton getter function.
Definition at line 714 of file ConfigurationSettings.cxx.
void top::ConfigurationSettings::loadFromFile | ( | const std::string & | filename | ) |
Read the settings from a text file given by.
filename | The filename to read from. |
Definition at line 723 of file ConfigurationSettings.cxx.
|
private |
Here but not implemented, resulting in a happy compile error if you try and use them.
void top::ConfigurationSettings::registerParameter | ( | const std::string & | name, |
const std::string & | message, | ||
const std::string & | default_val = "" , |
||
const std::vector< std::string > | allowed_values = {} |
||
) |
Add a variable to the configuration settings.
name | The key used to refer to this variable. |
message | A human readable explanation. |
default_val | Default value used for this setting. |
allowed_values | Possible choices for this setting (optional, by default all values are allowed). |
Definition at line 957 of file ConfigurationSettings.cxx.
bool top::ConfigurationSettings::retrieve | ( | std::string const & | key | ) | const |
void top::ConfigurationSettings::retrieve | ( | std::string const & | key, |
bool & | value | ||
) | const |
The user wants to know the boolean value for the specified key.
key | The string key used to identify this variable. |
value | On success, the setting for the given key (output). |
Note: an attempt to retrieve a key with a non-boolean values raises an exception.
Definition at line 1005 of file ConfigurationSettings.cxx.
const std::vector< SelectionConfigurationData > top::ConfigurationSettings::selections | ( | ) | const |
Get all the data needed to configure the selections.
Definition at line 1001 of file ConfigurationSettings.cxx.
const std::map< std::string, StringData > & top::ConfigurationSettings::stringData | ( | ) | const |
All the user input that is stored as strings.
Definition at line 997 of file ConfigurationSettings.cxx.
The user wants to know the value for the specified key.
key | The string key used to identify this variable. |
Definition at line 970 of file ConfigurationSettings.cxx.
|
private |
True if the class has read the settings from a file or something.
Definition at line 104 of file ConfigurationSettings.h.
|
staticprivate |
Singletons: Good or bad, you decide. // John says they are bad.
Definition at line 107 of file ConfigurationSettings.h.
|
private |
Kill-switch for experimental features.
Definition at line 116 of file ConfigurationSettings.h.
|
private |
Data used when configuring the selections.
Definition at line 113 of file ConfigurationSettings.h.
|
private |
Hold the configuration data.
Definition at line 110 of file ConfigurationSettings.h.