Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
Config Class Reference

Provides functionality to read from an xml configuration file. More...

#include <Config.h>

List of all members.

Classes

class  ConfigEntry

Public Member Functions

void addModule (std::string name)
void clear ()
 Config ()
 Config (const Config &c2)
std::string getActiveProfileName () const
std::string getAllProfileNames ()
std::vector< std::string > getAllVars () const
const std::string & getFilename () const
const std::vector< std::string > & getModuleList () const
bool loadFromFile (const std::string &fileName, const std::vector< std::string > &profiles)
Configoperator= (const Config &c2)
template<class T >
void set (const std::string &id, T f)
std::string toText ()
 ~Config ()

Static Public Member Functions

static bool getBool (const std::string &id)
static float getFloat (const std::string &id)
static bool getFloatMinMax (const std::string &id, std::pair< float, float > &minmax)
static ConfiggetInstance ()
static int getInt (const std::string &id)
static bool getIntMinMax (const std::string &id, std::pair< int, int > &minmax)
static std::string getString (const std::string &id)
static void loadConfig (const std::vector< std::string > files, const std::vector< std::string > profiles, const std::string &prepend_path=".")
 allows to load various config files and profiles besides config/default.xml and profile default
static void setInstance (Config *newInst)

Static Public Attributes

static Mutex m_AccessMutex = Mutex ()

Private Member Functions

std::vector< std::string > explode (const std::string &text, const std::string &separators, bool keepSeparators=false)
template<class T >
get (const std::string &id) const
template<class T >
bool getMinMax (const std::string &id, std::pair< T, T > &minmax) const
bool parseDocument (const std::string &fileName, const std::vector< std::string > &profiles)
void parseModules (TiXmlNode *root)
bool parseProfile (TiXmlNode *root)
bool parseValue (TiXmlElement *el, class ConfigEntry &newEntry, std::string &name) const
bool parseValues (const std::string &level, TiXmlNode *root)
void saveValue (const std::string &name, const ConfigEntry &entry, TiXmlElement *allProfValues, TiXmlElement *values) const

Private Attributes

std::string m_activeProfile
std::string m_allProfileNames
class TiXmlDocumentm_doc
std::string m_fileName
std::set< std::string > m_loadedProfileNames
std::vector< std::string > m_moduleList
std::map< std::string,
ConfigEntry
m_values

Static Private Attributes

static Configm_inst = 0

Detailed Description

Provides functionality to read from an xml configuration file.

Author:
Frank Neuhaus, David Gossow, Viktor Seib

Definition at line 32 of file Config.h.


Constructor & Destructor Documentation

Definition at line 26 of file Config.cpp.

Config::Config ( const Config c2)

Definition at line 36 of file Config.cpp.

Definition at line 31 of file Config.cpp.


Member Function Documentation

void Config::addModule ( std::string  name)

Definition at line 266 of file Config.cpp.

void Config::clear ( )

Definition at line 161 of file Config.cpp.

std::vector< std::string > Config::explode ( const std::string &  text,
const std::string &  separators,
bool  keepSeparators = false 
) [private]

helper function to parse string lists

Definition at line 582 of file Config.cpp.

std::string Config::get ( const std::string &  id) const [inline, private]

Definition at line 382 of file Config.h.

std::string Config::getActiveProfileName ( ) const [inline]

Definition at line 83 of file Config.h.

std::string Config::getAllProfileNames ( ) [inline]

Definition at line 85 of file Config.h.

std::vector< std::string > Config::getAllVars ( ) const

Definition at line 565 of file Config.cpp.

bool Config::getBool ( const std::string &  id) [static]

Definition at line 135 of file Config.cpp.

const std::string & Config::getFilename ( ) const [inline]

Definition at line 498 of file Config.h.

float Config::getFloat ( const std::string &  id) [static]

Definition at line 145 of file Config.cpp.

bool Config::getFloatMinMax ( const std::string &  id,
std::pair< float, float > &  minmax 
) [static]

Definition at line 150 of file Config.cpp.

Config * Config::getInstance ( ) [static]

Definition at line 62 of file Config.cpp.

int Config::getInt ( const std::string &  id) [static]

Definition at line 130 of file Config.cpp.

bool Config::getIntMinMax ( const std::string &  id,
std::pair< int, int > &  minmax 
) [static]

Definition at line 155 of file Config.cpp.

template<class T >
bool Config::getMinMax ( const std::string &  id,
std::pair< T, T > &  minmax 
) const [private]

Definition at line 469 of file Config.h.

const std::vector< std::string > & Config::getModuleList ( ) const

Definition at line 575 of file Config.cpp.

std::string Config::getString ( const std::string &  id) [static]

Definition at line 140 of file Config.cpp.

void Config::loadConfig ( const std::vector< std::string >  files,
const std::vector< std::string >  profiles,
const std::string &  prepend_path = "." 
) [static]

allows to load various config files and profiles besides config/default.xml and profile default

Parameters:
filesList of files that are loaded additionally
profilesList of profiles that are loaded additionally

Definition at line 79 of file Config.cpp.

bool Config::loadFromFile ( const std::string &  fileName,
const std::vector< std::string > &  profiles 
)

Definition at line 420 of file Config.cpp.

Config & Config::operator= ( const Config c2)

Definition at line 49 of file Config.cpp.

bool Config::parseDocument ( const std::string &  fileName,
const std::vector< std::string > &  profiles 
) [private]

Definition at line 354 of file Config.cpp.

void Config::parseModules ( TiXmlNode root) [private]

Definition at line 286 of file Config.cpp.

bool Config::parseProfile ( TiXmlNode root) [private]

Definition at line 306 of file Config.cpp.

bool Config::parseValue ( TiXmlElement el,
class ConfigEntry newEntry,
std::string &  name 
) const [private]

Definition at line 168 of file Config.cpp.

bool Config::parseValues ( const std::string &  level,
TiXmlNode root 
) [private]

Definition at line 234 of file Config.cpp.

void Config::saveValue ( const std::string &  name,
const ConfigEntry entry,
TiXmlElement allProfValues,
TiXmlElement values 
) const [private]

Definition at line 434 of file Config.cpp.

template<class T >
void Config::set ( const std::string &  id,
f 
)

Definition at line 454 of file Config.h.

static void Config::setInstance ( Config newInst) [inline, static]

Definition at line 41 of file Config.h.

std::string Config::toText ( )

Member Data Documentation

Mutex which protects getters, setters and setInstance

Definition at line 90 of file Config.h.

std::string Config::m_activeProfile [private]

Definition at line 104 of file Config.h.

std::string Config::m_allProfileNames [private]

Definition at line 109 of file Config.h.

class TiXmlDocument* Config::m_doc [private]

Definition at line 327 of file Config.h.

std::string Config::m_fileName [private]

Definition at line 103 of file Config.h.

Config * Config::m_inst = 0 [static, private]

Definition at line 325 of file Config.h.

std::set<std::string> Config::m_loadedProfileNames [private]

Definition at line 107 of file Config.h.

std::vector<std::string> Config::m_moduleList [private]

Definition at line 105 of file Config.h.

std::map<std::string, ConfigEntry> Config::m_values [private]

Definition at line 323 of file Config.h.


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


robbie_architecture
Author(s): Viktor Seib
autogenerated on Mon Oct 6 2014 02:53:09