0.2.0
Loading...
Searching...
No Matches
ConfigManager.hpp File Reference

Config management for the Project. More...

Go to the source code of this file.

Functions

void NAV::ConfigManager::CheckOptions (const int argc, const char *argv[])
 Writes all command line options into the log.
 
void NAV::ConfigManager::deinitialize ()
 Deinitializes the config manager. Call this if you want to Fetch config again.
 
std::vector< std::string > NAV::ConfigManager::FetchConfigs (const int argc, const char *argv[])
 Fetches the configs from the command line parameters.
 
template<typename T >
const T & NAV::ConfigManager::Get (const std::string &key)
 Retrieves the value of a corresponding key from the configuration, if it does not exists, throws an exception.
 
template<typename T >
const T & NAV::ConfigManager::Get (const std::string &key, const T &defaultValue)
 Retrieves the value of a corresponding key from the configuration, if one exists.
 
std::vector< std::string > NAV::ConfigManager::GetKeys ()
 Returns all keys in the configuration, as a vector.
 
const boost::program_options::options_description & NAV::ConfigManager::GetProgramOptions ()
 Get the Program Options object.
 
bool NAV::ConfigManager::HasKey (const std::string &key)
 Checks if a corresponding key exists in the configuration.
 
void NAV::ConfigManager::initialize ()
 Initializes the config manager. Call this function before using other functions.
 
void NAV::ConfigManager::LoadGlobalSettings ()
 Loads the global settings.
 
void NAV::ConfigManager::SaveGlobalSettings ()
 Saves the global settings.
 

Variables

boost::program_options::variables_map NAV::ConfigManager::vm
 Map which stores all options.
 

Detailed Description

Config management for the Project.

Author
T. Topp (topp@.nosp@m.ins..nosp@m.uni-s.nosp@m.tutt.nosp@m.gart..nosp@m.de)
Date
2020-03-11

Function Documentation

◆ CheckOptions()

void NAV::ConfigManager::CheckOptions ( const int argc,
const char * argv[] )

Writes all command line options into the log.

Parameters
[in]argcNumber of command line parameters
[in]argvArray of the command line parameters

◆ FetchConfigs()

std::vector< std::string > NAV::ConfigManager::FetchConfigs ( const int argc,
const char * argv[] )

Fetches the configs from the command line parameters.

Parameters
[in]argcNumber of command line parameters
[in]argvArray of the command line parameters
Returns
List of config files which failed to be read (for error reporting)

◆ Get() [1/2]

template<typename T >
const T & NAV::ConfigManager::Get ( const std::string & key)

Retrieves the value of a corresponding key from the configuration, if it does not exists, throws an exception.

Template Parameters
TReturn value type
Parameters
[in]keyKey to search for
Returns
The value found with the key

◆ Get() [2/2]

template<typename T >
const T & NAV::ConfigManager::Get ( const std::string & key,
const T & defaultValue )

Retrieves the value of a corresponding key from the configuration, if one exists.

Template Parameters
TReturn value type
Parameters
[in]keyKey to search for
[in]defaultValueIf key is not found, the default value is returned
Returns
The value found with the key or the default value

◆ GetProgramOptions()

const boost::program_options::options_description & NAV::ConfigManager::GetProgramOptions ( )

Get the Program Options object.

Returns
The object