#include <Config.hpp>
To use it, just instantiate an object of this type. All lookups will be prepended with the 'name' given.
Config config("MyTest"); std::string value = config.get("MyValue","MyDefault");
will look up 'Mytest.MyValue: ...' in the configuration file.
The configuration file is searched in the following places:
Definition at line 36 of file Config.hpp.
Public Member Functions | |
| Config (const std::string &name) | |
| virtual | ~Config () |
| void | set (const std::string &key, const std::string &value) |
| Set/Override an entry in the configuration database. | |
| void | dumpConfig (std::ostream &stream) |
| Dump config DB to given output stream. | |
| void | dumpConfig (TDirectory *const dir, std::string const name="configDB") |
| Dump config DB to given TDirectory. | |
Accessor | |
Return the default value if the parameter isn't set | |
| std::string | get (const std::string &key, const std::string &def) |
| Get string value from config DB. | |
| std::string | get (const std::string &key, const char *def) |
| Get string value from config DB. | |
| int | get (const std::string &key, int def) |
| Get integer value from config DB. | |
| double | get (const std::string &key, double def) |
| Get floating point value from config DB. | |
| bool | get (const std::string &key, bool def) |
| Get boolean value from config DB. | |
| std::vector< std::string > | getVString (const std::string &key, const std::string &delim="") |
| Get list of strings of config DB. | |
| std::vector< float > | getVFloat (const std::string &key, const std::string &delim="") |
| Get list of floats from config DB. | |
| std::vector< int > | getVInt (const std::string &key, const std::string &delim="") |
| Get list of integers from config DB. | |
Static Public Member Functions | |
| std::vector< std::string > | checkConfiguration () |
| Check that every processor P has accessed all the variables of the form 'P.X: ...'. | |
| std::vector< std::string > | variables (const std::string &name) |
| return list of all variables specified for the processor with name "name" | |
| void | resolve () |
| Re-run the variable expansion process. | |
Static Private Member Functions | |
| std::string | replace (TEnv *env, const std::string &input) |
| TEnv & | getEnv () |
Private Attributes | |
| std::string | _name |
Static Private Attributes | |
| std::set< std::string > | s_accessed |
| static | |
|
|
Definition at line 25 of file Config.cpp. |
|
|
Definition at line 29 of file Config.cpp. |
|
|
Check that every processor P has accessed all the variables of the form 'P.X: ...'. Report any variables that have not been accessed. Definition at line 290 of file Config.cpp. References getEnv(), and s_accessed. |
|
||||||||||||
|
Dump config DB to given TDirectory.
Definition at line 163 of file Config.cpp. References getEnv(). |
|
|
Dump config DB to given output stream.
Definition at line 148 of file Config.cpp. References getEnv(). Referenced by cafe::ConfigDumper::begin(), and cafe::ConfigDumper::finish(). |
|
||||||||||||
|
Get boolean value from config DB.
Definition at line 86 of file Config.cpp. References _name, getEnv(), and s_accessed. |
|
||||||||||||
|
Get floating point value from config DB.
Definition at line 79 of file Config.cpp. References _name, getEnv(), and s_accessed. |
|
||||||||||||
|
Get integer value from config DB.
Definition at line 72 of file Config.cpp. References _name, getEnv(), and s_accessed. |
|
||||||||||||
|
Get string value from config DB. This is needed because otherwise the 'bool' version of get() will be called for const char strings. Definition at line 65 of file Config.cpp. References _name, getEnv(), and s_accessed. |
|
||||||||||||
|
|
Definition at line 195 of file Config.cpp. References cafe::_cleanup, and s_accessed. Referenced by checkConfiguration(), dumpConfig(), get(), resolve(), set(), and variables(). |
|
||||||||||||
|
Get list of floats from config DB.
Definition at line 111 of file Config.cpp. References _name, get(), and s_accessed. |
|
||||||||||||
|
Get list of integers from config DB.
Definition at line 127 of file Config.cpp. References _name, get(), and s_accessed. |
|
||||||||||||
|
||||||||||||
|
Definition at line 32 of file Config.cpp. References s_accessed. Referenced by resolve(). |
|
|
Re-run the variable expansion process. Normally this is done automaticall when all input files have been read, so you don't need to call this. Definition at line 269 of file Config.cpp. |
|
||||||||||||
|
Set/Override an entry in the configuration database.
Definition at line 143 of file Config.cpp. References getEnv(). Referenced by main(), and cafe::Permute::Permute(). |
|
|
return list of all variables specified for the processor with name "name"
Definition at line 326 of file Config.cpp. References getEnv(). |
|
|
Definition at line 100 of file Config.hpp. Referenced by get(), getVFloat(), getVInt(), and getVString(). |
|
|
static
Definition at line 23 of file Config.cpp. Referenced by checkConfiguration(), get(), getEnv(), getVFloat(), getVInt(), getVString(), and replace(). |
1.3.4