OpenIG  2.0.4
cross-platform open-source OpenSceneGraph Image Generator
Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
OpenIG::Base::Configuration Class Reference

The Configuration class. More...

#include <Configuration.h>

Public Member Functions

bool readFromXML (const std::string &fileName, const std::string &section)
 Reads an XML file section and fills in the values in a token based std::map. More...
 
const std::string getConfig (const std::string &token, const std::string="")
 gets a value based on a given token and provides a default value if the token is not present More...
 
double getConfig (const std::string &token, double value=0.0)
 gets a value based on a given token and provides a default value if the token is not present More...
 
int getConfig (const std::string &token, int value=0)
 gets a value based on a given token and provides a default value if the token is not present More...
 

Static Public Member Functions

static Configurationinstance ()
 The Configuration singleton. More...
 

Protected Types

typedef std::map< std::string, std::string > ConfigMap
 
typedef std::map< std::string, std::string >::iterator ConfigMapIterator
 
typedef std::map< std::string, std::string >::const_iterator ConfigMapConstIterator
 

Protected Attributes

ConfigMap _configuration
 token based std::map of tag values
 

Detailed Description

The Configuration class.

Handy singleton to get access to values from an XML file

Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015

Member Function Documentation

const std::string OpenIG::Base::Configuration::getConfig ( const std::string &  token,
const std::string  = "" 
)

gets a value based on a given token and provides a default value if the token is not present

Parameters
token
Returns
the value
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
double OpenIG::Base::Configuration::getConfig ( const std::string &  token,
double  value = 0.0 
)

gets a value based on a given token and provides a default value if the token is not present

Parameters
token
Returns
the value
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
int OpenIG::Base::Configuration::getConfig ( const std::string &  token,
int  value = 0 
)

gets a value based on a given token and provides a default value if the token is not present

Parameters
token
Returns
the value
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
static Configuration* OpenIG::Base::Configuration::instance ( )
static

The Configuration singleton.

Returns
The Configuration singleton
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
bool OpenIG::Base::Configuration::readFromXML ( const std::string &  fileName,
const std::string &  section 
)

Reads an XML file section and fills in the values in a token based std::map.

Parameters
Thefile name of the XML
Thesection name from the XML
Returns
true on success, false on failure
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015

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