Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ModuleSettings.h
Go to the documentation of this file.
1#ifndef STORM_SETTINGS_MODULES_MODULESETTINGS_H_
2#define STORM_SETTINGS_MODULES_MODULESETTINGS_H_
3
4#include <memory>
5#include <string>
6#include <unordered_map>
7#include <vector>
8
9namespace storm {
10namespace settings {
11// Forward-declare some classes.
12class SettingsManager;
13class SettingMemento;
14class Option;
15
16namespace modules {
17
22 public:
23 // Declare the memento class as a friend so it can manipulate the internal state.
25
31 ModuleSettings(std::string const& moduleName);
32 virtual ~ModuleSettings() {}
33
39 virtual bool check() const;
40
44 virtual void finalize();
45
55 std::unique_ptr<storm::settings::SettingMemento> overrideOption(std::string const& name, bool requiredStatus);
56
62 std::string const& getModuleName() const;
63
69 std::vector<std::shared_ptr<Option>> const& getOptions() const;
70
78
82 void restoreDefaults();
83
84 protected:
91 Option& getOption(std::string const& longName);
92
99 Option const& getOption(std::string const& longName) const;
100
107 bool isSet(std::string const& optionName) const;
108
115 void set(std::string const& name);
116
123 void unset(std::string const& name);
124
130 void addOption(std::shared_ptr<Option> const& option);
131
132 private:
133 // The name of the module.
134 std::string moduleName;
135
136 // A mapping of option names of the module to the actual options.
137 std::unordered_map<std::string, std::shared_ptr<Option>> optionMap;
138
139 // The list of known option names in the order they were registered.
140 std::vector<std::shared_ptr<Option>> options;
141};
142
143} // namespace modules
144} // namespace settings
145} // namespace storm
146
147#endif /* STORM_SETTINGS_MODULES_MODULESETTINGS_H_ */
This class represents one command-line option.
Definition Option.h:27
This class is used to reset the state of an option that was temporarily set to a different status.
This is the base class of the settings for a particular module.
std::unique_ptr< storm::settings::SettingMemento > overrideOption(std::string const &name, bool requiredStatus)
Sets the option with the given name to the required status.
bool isSet(std::string const &optionName) const
Retrieves whether the option with the given name was set.
std::vector< std::shared_ptr< Option > > const & getOptions() const
Retrieves the options of this module.
void unset(std::string const &name)
Unsets the option with the specified name.
virtual bool check() const
Checks whether the settings are consistent.
void set(std::string const &name)
Sets the option with the specified name.
std::string const & getModuleName() const
Retrieves the name of the module to which these settings belong.
uint_fast64_t getPrintLengthOfLongestOption(bool includeAdvanced) const
Retrieves the (print) length of the longest option.
void addOption(std::shared_ptr< Option > const &option)
Adds and registers the given option.
virtual void finalize()
Prepares the modules for further usage, should be called at the end of the initialization,...
void restoreDefaults()
Restores the default values for all arguments of all options.
Option & getOption(std::string const &longName)
Retrieves the option with the given long name.
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18