paramfile Class Reference

#include <paramfile.h>

List of all members.

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>
find (const std::string &key) const
template<typename 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)


Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

void paramfile::setVerbosity ( bool  verbose_  )  [inline]

Allows adjusting the verbosity.

Definition at line 71 of file paramfile.h.

bool paramfile::getVerbosity (  )  const [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.

template<typename T>
T paramfile::find ( const std::string &  key  )  const [inline]

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.

template<typename T>
T paramfile::find ( const std::string &  key,
const T &  deflt 
) [inline]

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.

const params_type& paramfile::getParams (  )  const [inline]

Returns the entire set of currently stored parameters.

Definition at line 93 of file paramfile.h.

template<typename T>
void paramfile::setParam ( const std::string &  key,
const T &  value 
) [inline]

Sets the parameter with the name key to value.

Definition at line 97 of file paramfile.h.


The documentation for this class was generated from the following files:

Generated on Thu Oct 8 14:48:51 2015 for LevelS C++ support library