Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::settings::SettingsManager Class Reference

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::ModuleSettingsgetModule (std::string const &moduleName)
 Retrieves the settings of the module with the given name.
 

Static Public Member Functions

static SettingsManagermanager ()
 Retrieves the only existing instance of a settings manager.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SettingsManager()

storm::settings::SettingsManager::SettingsManager ( SettingsManager const )
delete

Member Function Documentation

◆ addModule()

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.

Parameters
moduleSettingsThe settings of the module to add.

Definition at line 407 of file SettingsManager.cpp.

◆ getHelpForModule()

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.

Parameters
moduleNameThe name of the module for which to show the help.
maxLengthThe maximal length of an option name (necessary for proper alignment).
includeAdvancedif set, also includes options flagged as advanced.

Definition at line 354 of file SettingsManager.cpp.

◆ getModule() [1/2]

modules::ModuleSettings & storm::settings::SettingsManager::getModule ( std::string const &  moduleName)

Retrieves the settings of the module with the given name.

Parameters
moduleNameThe name of the module for which to retrieve the settings.
Returns
An object that provides access to the settings of the module.

Definition at line 474 of file SettingsManager.cpp.

◆ getModule() [2/2]

modules::ModuleSettings const & storm::settings::SettingsManager::getModule ( std::string const &  moduleName) const

Retrieves the settings of the module with the given name.

Parameters
moduleNameThe name of the module for which to retrieve the settings.
Returns
An object that provides access to the settings of the module.

Definition at line 467 of file SettingsManager.cpp.

◆ handleUnknownOption()

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.

◆ hasModule()

bool storm::settings::SettingsManager::hasModule ( std::string const moduleName,
bool  checkHidden = false 
) const

Checks whether the module with the given name exists.

Parameters
moduleNameThe name of the module to search.
checkHiddenIf true hidden modules are included in the search.
Returns
True iff the module exists.

Definition at line 459 of file SettingsManager.cpp.

◆ manager()

SettingsManager & storm::settings::SettingsManager::manager ( )
static

Retrieves the only existing instance of a settings manager.

Returns
The only existing instance of a settings manager

Definition at line 57 of file SettingsManager.cpp.

◆ operator=()

◆ printHelp()

void storm::settings::SettingsManager::printHelp ( std::string const filter = "frequent") const

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.

Parameters
filterA regular expression to restrict the help output or "all" for the full help text.

Definition at line 216 of file SettingsManager.cpp.

◆ setFromCommandLine()

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.

Parameters
argcThe number of command line arguments.
argvThe command line arguments.

Definition at line 67 of file SettingsManager.cpp.

◆ setFromConfigurationFile()

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.

◆ setFromExplodedString()

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.

Parameters
commandLineArgumentsThe command line arguments.

Definition at line 119 of file SettingsManager.cpp.

◆ setFromString()

void storm::settings::SettingsManager::setFromString ( std::string const commandLineString)

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.

Parameters
commandLineStringThe command line arguments as one string.

Definition at line 78 of file SettingsManager.cpp.

◆ setName()

void storm::settings::SettingsManager::setName ( std::string const name,
std::string const executableName 
)

Sets the name of the tool.

Parameters
nameName of the tool.
executableNameFilename of the executable.

Definition at line 62 of file SettingsManager.cpp.


The documentation for this class was generated from the following files: