LevelS C++ support library
3.83
|
#include <paramfile.h>
Public Member Functions | |
paramfile (const std::string &filename, bool verbose_=true) | |
paramfile (const params_type &par, bool verbose_=true) | |
void | setVerbosity (bool verbose_) |
bool | getVerbosity () const |
bool | param_present (const std::string &key) const |
template<typename T > | |
T | find (const std::string &key) const |
template<typename T > | |
T | find (const std::string &key, const T &deflt) |
const params_type & | getParams () const |
template<typename T > | |
void | setParam (const std::string &key, const T &value) |
Class for storing and querying key/value pairs. The name is historical; the parameters can actually be obtained from othersources as well (e.g. the command line).
Definition at line 44 of file paramfile.h.
paramfile::paramfile | ( | const std::string & | filename, |
bool | verbose_ = true |
||
) |
Constructs a paramfile object from the contents of filename. If verbose_==true, diagnostic output is generated when calling methods on this object, otherwise not.
paramfile::paramfile | ( | const params_type & | par, |
bool | verbose_ = true |
||
) |
Constructs a paramfile object from the contents of par. If verbose_==true, diagnostic output is generated when calling methods on this object, otherwise not.
Definition at line 52 of file paramfile.cc.
|
inline |
Allows adjusting the verbosity.
Definition at line 71 of file paramfile.h.
|
inline |
Returns the verbosity setting of the object.
Definition at line 75 of file paramfile.h.
bool paramfile::param_present | ( | const std::string & | key | ) | const |
Returns true
, if a paremeter called key is stored in the object, else false
.
Definition at line 66 of file paramfile.cc.
T paramfile::find | ( | const std::string & | key | ) | const |
Returns the value stored for the parameter name key, after converting it to the requested type. If key is not present, an exception is thrown.
T paramfile::find | ( | const std::string & | key, |
const T & | deflt | ||
) |
Returns the value stored for the parameter name key, after converting it to the requested type. If key is not present, deflt is returned instead, and is also entered into the parameter set.
|
inline |
Returns the entire set of currently stored parameters.
Definition at line 93 of file paramfile.h.
|
inline |
Sets the parameter with the name key to value.
Definition at line 97 of file paramfile.h.