Storm
A Modern Probabilistic Model Checker
|
Provides the central API for the registration of command line options and parsing the options from the command line. More...
#include <SettingsManager.h>
Public Member Functions | |
SettingsManager (SettingsManager const &)=delete | |
void | operator= (SettingsManager const &)=delete |
void | setFromCommandLine (int const argc, char const *const argv[]) |
This function parses the given command line arguments and sets all registered options accordingly. | |
void | setFromString (std::string const &commandLineString) |
This function parses the given command line arguments (represented by one big string) and sets all registered options accordingly. | |
void | setFromExplodedString (std::vector< std::string > const &commandLineArguments) |
This function parses the given command line arguments (represented by several strings) and sets all registered options accordingly. | |
void | setFromConfigurationFile (std::string const &configFilename) |
This function parses the given file and sets all registered options accordingly. | |
void | handleUnknownOption (std::string const &optionName, bool isShort) const |
Throws an exception with a nice error message indicating similar valid option names. | |
void | printHelp (std::string const &filter="frequent") const |
This function prints a help message to the standard output. | |
std::string | getHelpForModule (std::string const &moduleName, uint_fast64_t maxLength=30, bool includeAdvanced=true) const |
This function prints a help message for the specified module to the standard output. | |
void | setName (std::string const &name, std::string const &executableName) |
Sets the name of the tool. | |
void | addModule (std::unique_ptr< modules::ModuleSettings > &&moduleSettings, bool doRegister=true) |
Adds a new module with the given name. | |
bool | hasModule (std::string const &moduleName, bool checkHidden=false) const |
Checks whether the module with the given name exists. | |
modules::ModuleSettings const & | getModule (std::string const &moduleName) const |
Retrieves the settings of the module with the given name. | |
modules::ModuleSettings & | getModule (std::string const &moduleName) |
Retrieves the settings of the module with the given name. | |
Static Public Member Functions | |
static SettingsManager & | manager () |
Retrieves the only existing instance of a settings manager. | |
Provides the central API for the registration of command line options and parsing the options from the command line.
Since this class is a singleton, the only instance is accessible via a call to the manager() function.
Definition at line 26 of file SettingsManager.h.
|
delete |
void storm::settings::SettingsManager::addModule | ( | std::unique_ptr< modules::ModuleSettings > && | moduleSettings, |
bool | doRegister = true |
||
) |
Adds a new module with the given name.
If the module could not be successfully added, an exception is thrown.
moduleSettings | The settings of the module to add. |
Definition at line 407 of file SettingsManager.cpp.
std::string storm::settings::SettingsManager::getHelpForModule | ( | std::string const & | moduleName, |
uint_fast64_t | maxLength = 30 , |
||
bool | includeAdvanced = true |
||
) | const |
This function prints a help message for the specified module to the standard output.
moduleName | The name of the module for which to show the help. |
maxLength | The maximal length of an option name (necessary for proper alignment). |
includeAdvanced | if set, also includes options flagged as advanced. |
Definition at line 354 of file SettingsManager.cpp.
modules::ModuleSettings & storm::settings::SettingsManager::getModule | ( | std::string const & | moduleName | ) |
Retrieves the settings of the module with the given name.
moduleName | The name of the module for which to retrieve the settings. |
Definition at line 474 of file SettingsManager.cpp.
modules::ModuleSettings const & storm::settings::SettingsManager::getModule | ( | std::string const & | moduleName | ) | const |
Retrieves the settings of the module with the given name.
moduleName | The name of the module for which to retrieve the settings. |
Definition at line 467 of file SettingsManager.cpp.
void storm::settings::SettingsManager::handleUnknownOption | ( | std::string const & | optionName, |
bool | isShort | ||
) | const |
Throws an exception with a nice error message indicating similar valid option names.
Definition at line 88 of file SettingsManager.cpp.
bool storm::settings::SettingsManager::hasModule | ( | std::string const & | moduleName, |
bool | checkHidden = false |
||
) | const |
Checks whether the module with the given name exists.
moduleName | The name of the module to search. |
checkHidden | If true hidden modules are included in the search. |
Definition at line 459 of file SettingsManager.cpp.
|
static |
Retrieves the only existing instance of a settings manager.
Definition at line 57 of file SettingsManager.cpp.
|
delete |
This function prints a help message to the standard output.
A string can be given as a filter. If it is 'frequent', only the options that are not flagged as advanced will be shown. If it is 'all', the complete help is shown. Otherwise, the string is interpreted as a regular expression and matched against the known modules and options to restrict the help output.
filter | A regular expression to restrict the help output or "all" for the full help text. |
Definition at line 216 of file SettingsManager.cpp.
void storm::settings::SettingsManager::setFromCommandLine | ( | int const | argc, |
char const *const | argv[] | ||
) |
This function parses the given command line arguments and sets all registered options accordingly.
If the command line cannot be matched using the known options, an exception is thrown.
argc | The number of command line arguments. |
argv | The command line arguments. |
Definition at line 67 of file SettingsManager.cpp.
void storm::settings::SettingsManager::setFromConfigurationFile | ( | std::string const & | configFilename | ) |
This function parses the given file and sets all registered options accordingly.
If the settings cannot be matched using the known options, an exception is thrown.
Definition at line 188 of file SettingsManager.cpp.
void storm::settings::SettingsManager::setFromExplodedString | ( | std::vector< std::string > const & | commandLineArguments | ) |
This function parses the given command line arguments (represented by several strings) and sets all registered options accordingly.
If the command line cannot be matched using the known options, an exception is thrown.
commandLineArguments | The command line arguments. |
Definition at line 119 of file SettingsManager.cpp.
This function parses the given command line arguments (represented by one big string) and sets all registered options accordingly.
If the command line cannot be matched using the known options, an exception is thrown.
commandLineString | The command line arguments as one string. |
Definition at line 78 of file SettingsManager.cpp.
void storm::settings::SettingsManager::setName | ( | std::string const & | name, |
std::string const & | executableName | ||
) |
Sets the name of the tool.
name | Name of the tool. |
executableName | Filename of the executable. |
Definition at line 62 of file SettingsManager.cpp.