Deepsolver
Public Member Functions
Deepsolver::ConfigCenter Class Reference

The central configuration processing class. More...

Inheritance diagram for Deepsolver::ConfigCenter:
Deepsolver::ConfigAdapter Deepsolver::Solver::AbstractProvidePriority Deepsolver::AbstractConfigFileHandler

List of all members.

Public Member Functions

VarId byProvidesPriorityList (const VarIdVector &vars, PkgId providePkgId) const override
void commit ()
 Verifies read configuration data.
 ConfigCenter ()
 The default constructor.
void loadFromDir (const std::string &path)
void loadFromFile (const std::string &fileName)
 reads single configuration file
void printConfigData (std::ostream &s) const
const ConfRootroot () const
 Returns the reference to parsed configuration data.
virtual ~ConfigCenter ()
 The destructor.

Detailed Description

This class designed as central place to store all configuration information necessary for all operations except repository index building. Every client application should create the instance of this class, process with it configuration files it need and provide the reference to OperationCore or InfoCore classes depending on required task.

Configuration center class strongly associated with ConfigFile class since it is used for configuration file syntax processing. During configuration file reading two types of exceptions can be thrown: ConfigFileException and ConfigException. The first type is used for syntax error indication only, the second one is designed for general configuration data validation problems.

Do not forget to call commit() method after configuration files reading. Some data may be left unprepared without commit() method invocation. After configuration files processing configuration data is placed in various structures gathered in ConfRoot type and can be accessed directly.

See also:
ConfRoot ConfigFile ConfigException ConfigFileException

Member Function Documentation

void Deepsolver::ConfigCenter::commit ( )

This method makes final configuration data preparing and performs various checks to be sure the data is valid. In case of errors ConfigException or ConfigFileException can be thrown. This method call is strongly required for proper further execution.

See also:
ConfigException ConfigFileException
void Deepsolver::ConfigCenter::loadFromFile ( const std::string &  fileName)

This method reads one configuration file parses it and saves processed values into internal structures for further access. You can call it multiple times for different files but do not forget make final invocation of commit() method to validate received data.

This method throws two types of exceptions: ConfigFileException to indicate syntax problems and ConfigException for general errors.

Parameters:
[in]fileNameName of the file to read configuration data from
See also:
ConfigException ConfigFileException
const ConfRoot& Deepsolver::ConfigCenter::root ( ) const [inline]

This method used for access to parsed values after configuration data reading during operations processing.

Returns:
The reference to parsed data
See also:
ConfRoot