Browse Source

prepare to initialize but not make settings known, not yet fully functioning

tempestpy_adaptions
Sebastian Junges 7 years ago
parent
commit
d271824461
  1. 5
      src/storm/settings/SettingsManager.cpp
  2. 6
      src/storm/settings/SettingsManager.h

5
src/storm/settings/SettingsManager.cpp

@ -271,7 +271,7 @@ namespace storm {
return moduleIterator->second->getPrintLengthOfLongestOption();
}
void SettingsManager::addModule(std::unique_ptr<modules::ModuleSettings>&& moduleSettings) {
void SettingsManager::addModule(std::unique_ptr<modules::ModuleSettings>&& moduleSettings, bool doRegister) {
auto moduleIterator = this->modules.find(moduleSettings->getModuleName());
STORM_LOG_THROW(moduleIterator == this->modules.end(), storm::exceptions::IllegalFunctionCallException, "Unable to register module '" << moduleSettings->getModuleName() << "' because a module with the same name already exists.");
@ -282,6 +282,7 @@ namespace storm {
auto iterator = this->modules.find(moduleName);
std::unique_ptr<modules::ModuleSettings> const& settings = iterator->second;
if (doRegister) {
// Now register the options of the module.
this->moduleOptions.emplace(moduleName, std::vector<std::shared_ptr<Option>>());
for (auto const& option : settings->getOptions()) {
@ -289,6 +290,8 @@ namespace storm {
}
}
}
void SettingsManager::addOption(std::shared_ptr<Option> const& option) {
// First, we register to which module the given option belongs.
auto moduleOptionIterator = this->moduleOptions.find(option->getModuleName());

6
src/storm/settings/SettingsManager.h

@ -101,7 +101,7 @@ namespace storm {
*
* @param moduleSettings The settings of the module to add.
*/
void addModule(std::unique_ptr<modules::ModuleSettings>&& moduleSettings);
void addModule(std::unique_ptr<modules::ModuleSettings>&& moduleSettings, bool doRegister = true);
/*!
* Retrieves the settings of the module with the given name.
@ -238,9 +238,9 @@ namespace storm {
* Add new module to use for the settings. The new module is given as a template argument.
*/
template<typename SettingsType>
void addModule() {
void addModule(bool doRegister = true) {
static_assert(std::is_base_of<storm::settings::modules::ModuleSettings, SettingsType>::value, "Template argument must be derived from ModuleSettings");
mutableManager().addModule(std::unique_ptr<modules::ModuleSettings>(new SettingsType()));
mutableManager().addModule(std::unique_ptr<modules::ModuleSettings>(new SettingsType()), doRegister);
}
/*!

Loading…
Cancel
Save