In file /home/eternity/Source/Common/ConfigFile/H/configFile.h:

class ConfigFile

Configuration file

Inheritance:

ConfigFile


Public Methods

ConfigFile::ConfigFile (string name)
Config file constructor
string ConfigFile::GetValue (string name)
Returns value asociated vith name Looks the key in STL map container and returns the associated value, that was specified in configuration file like this:
key1 value1
key2 value2
Err ConfigFile::Load ()
Loads settings from config file
void ConfigFile::PrintAll ()
Lists all variables to stdout
Err ConfigFile::Reload ()
Reloads settings from config file
ConfigFile::~ConfigFile ()
Config file destructor

Public

methods
ConfigFile (string fileName)
Opens and reads config from file.
~ConfigFile ()
Destructor
string GetValue (string name)
Returns value of variable called "name".
Err Reload ()
Reloads settings from file.
void PrintAll ()
prints all variables to stdout.

Private

attributes
string fileName
Name of configuration file
pthread_mutex_t mutex
Mutex to protect internal structures.
CfgVariables cfgVariables
Array of pairs of name and value.
methods
Err Load ()
Loads settings from file.
Err PrintVar (CfgVariable *var)
Prints variable var to stdout.

Documentation

Configuration file. Encapsulates work with configuration file. When created requires config name - reads it in memory and then is ready to answer questions about keys and values defined. It can also be reloaded.
attributes

string fileName
Name of configuration file

pthread_mutex_t mutex
Mutex to protect internal structures.

CfgVariables cfgVariables
Array of pairs of name and value.

methods

Err Load()
Loads settings from file.

Err PrintVar(CfgVariable *var)
Prints variable var to stdout.

methods

ConfigFile(string fileName)
Opens and reads config from file.

~ConfigFile()
Destructor

string GetValue(string name)
Returns value of variable called "name".

Err Reload()
Reloads settings from file.

void PrintAll()
prints all variables to stdout.

ConfigFile::ConfigFile(string name)
Config file constructor. Creates a mutex for protecting the STL map container. Reads configuration from specified file.
Parameters:
name - Name of the file that contains configuration data.
Author:
Venca
See Also:
co_se_toho_tyka

string ConfigFile::GetValue(string name)
Returns value asociated vith name Looks the key in STL map container and returns the associated value, that was specified in configuration file like this:
key1 value1
key2 value2
Returns:
String that is associated with the specified key.
Parameters:
name - String key that we want to look up in configuration file.
Author:
Venca
See Also:
Load()

Err ConfigFile::Load()
Loads settings from config file. Opens the file with O_SHLOCK so that noone can modify the file as it is read. The configuration file is read into memory - it is really small and has to be loaded anyway. And then the strings are parsed and stored in a STL map container as pairs key -> value.
Returns:
OK if success else KO
Author:
Venca
See Also:
ReLoad()

void ConfigFile::PrintAll()
Lists all variables to stdout. Prints all the pairs key -> value from STL map to stdout. Just for debugging purposes.
Author:
Venca
See Also:
Load()

Err ConfigFile::Reload()
Reloads settings from config file. Calls method Load that once more processes the configuration file.
Returns:
OK if success else KO.
Author:
Venca
See Also:
Load()

ConfigFile::~ConfigFile()
Config file destructor. Destroys mutex that was used to protect access to STL map container.
Author:
Venca
See Also:
ConfigFile


This class has no child classes.
Author:
Venca
See Also:
Mix Acs Eso Client Bank

alphabetic index hierarchy of classes


generated by doc++