0.3.0
Loading...
Searching...
No Matches
NAV::ConfigManager Namespace Reference

Functions

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

Variables

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

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

Definition at line 113 of file ConfigManager.cpp.

◆ deinitialize()

void NAV::ConfigManager::deinitialize ( )

Deinitializes the config manager. Call this if you want to Fetch config again.

Definition at line 68 of file ConfigManager.cpp.

◆ 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)

Definition at line 78 of file ConfigManager.cpp.

◆ 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

Definition at line 73 of file ConfigManager.hpp.

◆ 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

Definition at line 58 of file ConfigManager.hpp.

◆ GetKeys()

std::vector< std::string > NAV::ConfigManager::GetKeys ( )

Returns all keys in the configuration, as a vector.

Definition at line 168 of file ConfigManager.cpp.

◆ GetProgramOptions()

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

Get the Program Options object.

Returns
The object

Definition at line 73 of file ConfigManager.cpp.

◆ HasKey()

bool NAV::ConfigManager::HasKey ( const std::string & key)

Checks if a corresponding key exists in the configuration.

Definition at line 163 of file ConfigManager.cpp.

◆ initialize()

void NAV::ConfigManager::initialize ( )

Initializes the config manager. Call this function before using other functions.

Definition at line 36 of file ConfigManager.cpp.

◆ LoadGlobalSettings()

void NAV::ConfigManager::LoadGlobalSettings ( )

Loads the global settings.

Definition at line 209 of file ConfigManager.cpp.

◆ SaveGlobalSettings()

void NAV::ConfigManager::SaveGlobalSettings ( )

Saves the global settings.

Definition at line 180 of file ConfigManager.cpp.

Variable Documentation

◆ vm

boost::program_options::variables_map NAV::ConfigManager::vm
extern

Map which stores all options.

Definition at line 34 of file ConfigManager.cpp.