Browse Source

Removed a wrong and unnecessary validation function from ExplicitModelAdapter.cpp

Former-commit-id: 9f1aeaf27c
tempestpy_adaptions
PBerger 11 years ago
parent
commit
cb1c3965ba
  1. 42
      src/adapters/ExplicitModelAdapter.cpp

42
src/adapters/ExplicitModelAdapter.cpp

@ -27,47 +27,7 @@
extern log4cplus::Logger logger;
bool ExplicitModelAdapterOptionsRegistered = storm::settings::Settings::registerNewModule([] (storm::settings::Settings* instance) -> bool {
instance->addOption(storm::settings::OptionBuilder("ExplicitModelAdapter", "constants", "", "Specifies the constant replacements to use in Explicit Models").addArgument(storm::settings::ArgumentBuilder::createStringArgument("constantString", "A comma separated list of constants and their value, e.g. a=1,b=2,c=3").addValidationFunctionString(
[] (std::string const s, std::string& errorMessageTarget) -> bool {
// since regex is not yet implemented in gccs C++11, we have to check by hand
std::vector<std::string> constants;
// split for single assignment expressions
boost::split(constants, s, boost::is_any_of(","));
for (auto it = constants.cbegin(); it != constants.cend(); ++it) {
std::vector<std::string> constant;
boost::split(constant, *it, boost::is_any_of("="));
if (constant.size() != 2) {
std::ostringstream stream;
stream << "Expected one \"=\" in constant definition: \"" << *it << "\"" << std::endl;
errorMessageTarget.append(stream.str());
return false;
}
// Constant Name check
bool error = false;
std::for_each(constant.at(0).cbegin(), constant.at(0).cend(), [&error, &errorMessageTarget] (const std::string::value_type value) -> void {
if (!(('a' <= value && value <= 'z') || ('A' <= value && value <= 'Z') || ('0' <= value && value <= '9'))) {
std::ostringstream stream;
stream << "Illegal character in constant name: \"" << value << "\"" << std::endl;
errorMessageTarget.append(stream.str());
error = true;
}
});
// Value Check
std::for_each(constant.at(1).cbegin(), constant.at(1).cend(), [&error, &errorMessageTarget] (const std::string::value_type value) -> void {
if (!(('a' <= value && value <= 'z') || ('A' <= value && value <= 'Z') || ('0' <= value && value <= '9'))) {
std::ostringstream stream;
stream << "Illegal character in constant value: \"" << value << "\"" << std::endl;
errorMessageTarget.append(stream.str());
error = true;
}
});
if (error) {
return false;
}
}
return true;
}).setDefaultValueString("").build()).build());
instance->addOption(storm::settings::OptionBuilder("ExplicitModelAdapter", "constants", "", "Specifies the constant replacements to use in Explicit Models").addArgument(storm::settings::ArgumentBuilder::createStringArgument("constantString", "A comma separated list of constants and their value, e.g. a=1,b=2,c=3").setDefaultValueString("").build()).build());
return true;
});

Loading…
Cancel
Save