21#include <boost/program_options/options_description.hpp>
22#include <boost/program_options/variables_map.hpp>
26namespace NAV::ConfigManager
29extern boost::program_options::variables_map
vm;
45std::vector<std::string>
FetchConfigs(
const int argc,
const char* argv[]);
58const T&
Get(
const std::string& key,
const T& defaultValue)
62 return vm[key].as<T>();
73const T&
Get(
const std::string& key)
77 return vm[key].as<T>();
80 throw std::runtime_error(fmt::format(
"The key '{}' does not exist.", key));
void LoadGlobalSettings()
Loads the global settings.
void initialize()
Initializes the config manager. Call this function before using other functions.
boost::program_options::variables_map vm
Map which stores all options.
const T & Get(const std::string &key, const T &defaultValue)
Retrieves the value of a corresponding key from the configuration, if one exists.
Definition ConfigManager.hpp:58
void CheckOptions(const int argc, const char *argv[])
Writes all command line options into the log.
bool HasKey(const std::string &key)
Checks if a corresponding key exists in the configuration.
std::vector< std::string > GetKeys()
Returns all keys in the configuration, as a vector.
std::vector< std::string > FetchConfigs(const int argc, const char *argv[])
Fetches the configs from the command line parameters.
const boost::program_options::options_description & GetProgramOptions()
Get the Program Options object.
void deinitialize()
Deinitializes the config manager. Call this if you want to Fetch config again.
void SaveGlobalSettings()
Saves the global settings.