Parsing the configuration file and providing it to other classes. More...
#include <TreqsConfig.h>
Public Member Functions | |
std::string | getConfigpath () |
Getter. | |
void | setConfigpath (std::string) throw (FileNotFoundError) |
Setter. | |
std::string | getValue (std::string sec, std::string key) throw (ConfigNotFoundError) |
void | dumpConfig () |
void | reloadConfig () |
Static Public Member Functions | |
static TreqsConfig * | getInstance () |
Singleton access. | |
Protected Member Functions | |
TreqsConfig () | |
Constructor. | |
Private Member Functions | |
void | findConfigpath () throw (FileNotFoundError) |
Computes the configuration file. | |
void | parse_config () |
Using the Configpath, this function parses the file and loads the configuration. | |
Private Attributes | |
std::string | Configpath |
Path to the configuration file. | |
Static Private Attributes | |
static TreqsConfig * | _singleton = 0 |
pointer to the Singleton instance | |
static Destroyer< TreqsConfig > | _destroyer |
the destroyer is responsible for cleaning the singleton on destruction | |
static std::map< ConfigKey_t, std::string > | Configuration |
The map containing the configuration. | |
static log4cxx::LoggerPtr | logger |
The logger. |
Parsing the configuration file and providing it to other classes.
treqs::TreqsConfig::TreqsConfig | ( | ) | [protected] |
Constructor.
void treqs::TreqsConfig::dumpConfig | ( | ) |
dump configuration in the logging device.
void treqs::TreqsConfig::findConfigpath | ( | ) | throw (FileNotFoundError) [private] |
Computes the configuration file.
Order is : 1. command line "--config" parameter 2. $HOME/.treqs.conf 3. $TREQSC_HOME/etc/treqs.conf 4. /etc/treqs.conf If found nowhere, don't try to continue, it's hopeless. Throw an exception
std::string treqs::TreqsConfig::getConfigpath | ( | ) |
Getter.
TreqsConfig * treqs::TreqsConfig::getInstance | ( | ) | [static] |
Singleton access.
string treqs::TreqsConfig::getValue | ( | std::string | sec, | |
std::string | key | |||
) | throw (ConfigNotFoundError) |
Find the value for a defined parameter. If not present, throws a ConfigNotFoundException
sec | the section | |
key | the key |
void treqs::TreqsConfig::parse_config | ( | ) | [private] |
Using the Configpath, this function parses the file and loads the configuration.
void treqs::TreqsConfig::reloadConfig | ( | ) |
Reload the configuration parameters from config file
void treqs::TreqsConfig::setConfigpath | ( | std::string | cfgpath | ) | throw (FileNotFoundError) |
Setter.
Destroyer< TreqsConfig > treqs::TreqsConfig::_destroyer [static, private] |
the destroyer is responsible for cleaning the singleton on destruction
TreqsConfig * treqs::TreqsConfig::_singleton = 0 [static, private] |
pointer to the Singleton instance
std::string treqs::TreqsConfig::Configpath [private] |
Path to the configuration file.
map< ConfigKey_t, string > treqs::TreqsConfig::Configuration [static, private] |
The map containing the configuration.
LoggerPtr treqs::TreqsConfig::logger [static, private] |
The logger.