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. 13
      src/storm/settings/SettingsManager.cpp
  2. 6
      src/storm/settings/SettingsManager.h

13
src/storm/settings/SettingsManager.cpp

@ -271,7 +271,7 @@ namespace storm {
return moduleIterator->second->getPrintLengthOfLongestOption(); 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()); 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."); 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,11 +282,14 @@ namespace storm {
auto iterator = this->modules.find(moduleName); auto iterator = this->modules.find(moduleName);
std::unique_ptr<modules::ModuleSettings> const& settings = iterator->second; std::unique_ptr<modules::ModuleSettings> const& settings = iterator->second;
// Now register the options of the module.
this->moduleOptions.emplace(moduleName, std::vector<std::shared_ptr<Option>>());
for (auto const& option : settings->getOptions()) {
this->addOption(option);
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()) {
this->addOption(option);
}
} }
} }
void SettingsManager::addOption(std::shared_ptr<Option> const& option) { void SettingsManager::addOption(std::shared_ptr<Option> const& option) {

6
src/storm/settings/SettingsManager.h

@ -101,7 +101,7 @@ namespace storm {
* *
* @param moduleSettings The settings of the module to add. * @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. * 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. * Add new module to use for the settings. The new module is given as a template argument.
*/ */
template<typename SettingsType> 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"); 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