msbGrid  1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
msbGrid::ParameterTree Class Reference

#include <parametertree.hh>

Classes

struct  Parser
 
struct  Parser< bool >
 
struct  Parser< std::basic_string< char, traits, Allocator > >
 
struct  Parser< std::vector< T, A > >
 

Public Types

typedef std::vector< std::string > KeyVector
 

Public Member Functions

 ParameterTree ()
 
bool hasKey (const std::string &key) const
 
bool hasSub (const std::string &sub) const
 
std::string & operator[] (const std::string &key)
 
const std::string & operator[] (const std::string &key) const
 
void report (std::ostream &stream=std::cout, const std::string &prefix="") const
 
ParameterTreesub (const std::string &sub)
 
const ParameterTreesub (const std::string &sub) const
 
std::string get (const std::string &key, const std::string &defaultValue) const
 
std::string get (const std::string &key, const char *defaultValue) const
 
int get (const std::string &key, int defaultValue) const
 
double get (const std::string &key, double defaultValue) const
 
template<typename T >
get (const std::string &key, const T &defaultValue) const
 get value converted to a certain type More...
 
template<class T >
get (const std::string &key) const
 Get value. More...
 
const KeyVectorgetValueKeys () const
 
const KeyVectorgetSubKeys () const
 

Static Public Member Functions

static ParameterTreetree ()
 

Static Protected Member Functions

static std::string ltrim (const std::string &s)
 
static std::string rtrim (const std::string &s)
 
static std::vector< std::string > split (const std::string &s)
 
template<class Iterator >
static void parseRange (const std::string &str, Iterator it, const Iterator &end)
 

Protected Attributes

KeyVector valueKeys
 
KeyVector subKeys
 
std::map< std::string,
std::string > 
values
 
std::map< std::string,
ParameterTree
subs
 

Detailed Description

Definition at line 39 of file parametertree.hh.

Member Typedef Documentation

typedef std :: vector< std :: string > msbGrid::ParameterTree::KeyVector

Definition at line 42 of file parametertree.hh.

Constructor & Destructor Documentation

msbGrid::ParameterTree::ParameterTree ( )

Definition at line 168 of file parametertree.hh.

Member Function Documentation

std::string msbGrid::ParameterTree::get ( const std::string &  key,
const std::string &  defaultValue 
) const

Definition at line 300 of file parametertree.hh.

std::string msbGrid::ParameterTree::get ( const std::string &  key,
const char *  defaultValue 
) const

Definition at line 309 of file parametertree.hh.

int msbGrid::ParameterTree::get ( const std::string &  key,
int  defaultValue 
) const

Definition at line 318 of file parametertree.hh.

double msbGrid::ParameterTree::get ( const std::string &  key,
double  defaultValue 
) const

Definition at line 327 of file parametertree.hh.

template<typename T >
T msbGrid::ParameterTree::get ( const std::string &  key,
const T &  defaultValue 
) const
inline

get value converted to a certain type

Returns value as type T for given key.

Template Parameters
Ttype of returned value.
Parameters
keykey name
defaultValuedefault if key does not exist
Returns
value converted to T

Definition at line 87 of file parametertree.hh.

template<class T >
T msbGrid::ParameterTree::get ( const std::string &  key) const
inline

Get value.

Template Parameters
TType of the value
Parameters
keyKey name
Exceptions
RangeErrorif key does not exist
NotImplementedType is not supported
Returns
value as T

Definition at line 105 of file parametertree.hh.

const msbGrid::ParameterTree::KeyVector & msbGrid::ParameterTree::getSubKeys ( ) const

Definition at line 381 of file parametertree.hh.

const msbGrid::ParameterTree::KeyVector & msbGrid::ParameterTree::getValueKeys ( ) const

Definition at line 376 of file parametertree.hh.

bool msbGrid::ParameterTree::hasKey ( const std::string &  key) const

Definition at line 190 of file parametertree.hh.

bool msbGrid::ParameterTree::hasSub ( const std::string &  sub) const

Definition at line 207 of file parametertree.hh.

std::string msbGrid::ParameterTree::ltrim ( const std::string &  s)
staticprotected

Definition at line 336 of file parametertree.hh.

std::string & msbGrid::ParameterTree::operator[] ( const std::string &  key)

Definition at line 257 of file parametertree.hh.

const std::string & msbGrid::ParameterTree::operator[] ( const std::string &  key) const

Definition at line 278 of file parametertree.hh.

template<class Iterator >
static void msbGrid::ParameterTree::parseRange ( const std::string &  str,
Iterator  it,
const Iterator &  end 
)
inlinestaticprotected

Definition at line 143 of file parametertree.hh.

void msbGrid::ParameterTree::report ( std::ostream &  stream = std :: cout,
const std::string &  prefix = "" 
) const

Definition at line 171 of file parametertree.hh.

std::string msbGrid::ParameterTree::rtrim ( const std::string &  s)
staticprotected

Definition at line 347 of file parametertree.hh.

std::vector< std::string > msbGrid::ParameterTree::split ( const std::string &  s)
staticprotected

Definition at line 358 of file parametertree.hh.

msbGrid::ParameterTree & msbGrid::ParameterTree::sub ( const std::string &  sub)

Definition at line 224 of file parametertree.hh.

const msbGrid::ParameterTree & msbGrid::ParameterTree::sub ( const std::string &  sub) const

Definition at line 240 of file parametertree.hh.

static ParameterTree& msbGrid::ParameterTree::tree ( )
inlinestatic

Definition at line 49 of file parametertree.hh.

Member Data Documentation

KeyVector msbGrid::ParameterTree::subKeys
protected

Definition at line 133 of file parametertree.hh.

std :: map< std :: string, ParameterTree > msbGrid::ParameterTree::subs
protected

Definition at line 136 of file parametertree.hh.

KeyVector msbGrid::ParameterTree::valueKeys
protected

Definition at line 132 of file parametertree.hh.

std :: map< std :: string, std :: string > msbGrid::ParameterTree::values
protected

Definition at line 135 of file parametertree.hh.


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