CARMA C++
|
Abstract Base class for managing configuration files. More...
#include <carma/util/ConfigChecker.h>
Public Member Functions | |
ConfigChecker (const std::string &filename) | |
Constructor. More... | |
log4cpp::Category & | getLogger () const |
Get a logger. More... | |
std::string | getValue (const ::std::string &key) const |
return the value associated with key. More... | |
void | start () |
start reading the configuration file in a separate thread More... | |
bool | valueIsEmpty (const ::std::string &key) const |
bool | valueIsOneString (const ::std::string &key) const |
bool | valueIsZeroString (const ::std::string &key) const |
virtual | ~ConfigChecker () |
Destructor. More... | |
Protected Member Functions | |
bool | getConfigFileNotFound () const |
Protected Attributes | |
const ::std::string | kOneString_ |
const ::std::string | kZeroString_ |
Abstract Base class for managing configuration files.
This class will spawn a thread and read the input configuration file every N seconds and store its contents internally. Sub-classes will present an API allowing read-only access to config parameters allowing run-time program manipulation(ie. turning on/off debugging, turning on/off listeners or monitoring output etc.). Delay between file reads is controlled using the 'delayBetweenFileReads' parameter in the configuration file. The default is 5 seconds. The input config file can also be changed by using the configFilename parameter. This allows one to switch to a private file with minimal changes to the default system file. By using a filename of 'default', the code will read the original filename passed in the constructor. Class is thread safe.
Definition at line 106 of file ConfigChecker.h.
|
explicit |
Constructor.
|
virtual |
Destructor.
log4cpp::Category& carma::util::ConfigChecker::getLogger | ( | ) | const |
Get a logger.
std::string carma::util::ConfigChecker::getValue | ( | const ::std::string & | key | ) | const |
return the value associated with key.
If key does not exist, then an empty string ("") is returned.
void carma::util::ConfigChecker::start | ( | ) |
start reading the configuration file in a separate thread