The Config class is a singleton that stores program config read from the config file, with applied defaults if the config file cannot be read, or a config parameter is not in the config file.
More...
#include <util.h>
|
|
| Config () |
| | Constructor.
|
| |
| void | ReadAndUpdateConfig (const fs::path &config_file) |
| | Reads and parses the config file provided by the argument and populates m_config_in, then calls private method ProcessArgs() to populate m_config. More...
|
| |
| config_variant | GetArg (const std::string &arg) |
| | Provides the config_variant type value of the config parameter (argument). More...
|
| |
|
| std::string | GetArgString (const std::string &arg, const std::string &default_value) const |
| | Private version of GetArg that operates on m_config_in and also selects the provided default value if the arg is not found. This is how default values for parameters are established. More...
|
| |
|
|
std::multimap< std::string, config_variant > | m_config |
| | Holds the processed parameter-values, which are strongly typed and in a config_variant union, and where default values are populated if not found in the config file (m_config_in).
|
| |
|
|
virtual void | ProcessArgs ()=0 |
| | Private helper method used by ReadAndUpdateConfig. Note this is pure virtual. It must be implemented in a specialization of a derived class for use by a specific application.
|
| |
|
|
std::mutex | mtx_config |
| | This is the mutex member that provides lock control for the config object. This is used to ensure the config object is thread-safe.
|
| |
|
std::multimap< std::string, std::string > | m_config_in |
| | Holds the raw parsed parameter-values from the config file.
|
| |
The Config class is a singleton that stores program config read from the config file, with applied defaults if the config file cannot be read, or a config parameter is not in the config file.
◆ GetArg()
| config_variant Config::GetArg |
( |
const std::string & |
arg | ) |
|
Provides the config_variant type value of the config parameter (argument).
- Parameters
-
| arg | (key) to look up value. |
- Returns
- config_variant type value of the value of the config parameter (argument).
◆ GetArgString()
| std::string Config::GetArgString |
( |
const std::string & |
arg, |
|
|
const std::string & |
default_value |
|
) |
| const |
|
protected |
Private version of GetArg that operates on m_config_in and also selects the provided default value if the arg is not found. This is how default values for parameters are established.
- Parameters
-
| arg | (key) to look up value as string. |
| default_value | if arg is not found. |
- Returns
- string value found in lookup, default value if not found.
◆ ReadAndUpdateConfig()
| void Config::ReadAndUpdateConfig |
( |
const fs::path & |
config_file | ) |
|
Reads and parses the config file provided by the argument and populates m_config_in, then calls private method ProcessArgs() to populate m_config.
- Parameters
-
The documentation for this class was generated from the following files: