You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.6 KiB
39 lines
1.6 KiB
#include "storm-parsers/parser/ValueParser.h"
|
|
|
|
#include "storm/exceptions/NotSupportedException.h"
|
|
|
|
namespace storm {
|
|
namespace parser {
|
|
|
|
template<typename ValueType>
|
|
void ValueParser<ValueType>::addParameter(std::string const& parameter) {
|
|
STORM_LOG_THROW(false, storm::exceptions::NotSupportedException, "Parameters are not supported in this build (Have you checked storm-pars?).");
|
|
}
|
|
|
|
template<>
|
|
void ValueParser<storm::RationalFunction>::addParameter(std::string const& parameter) {
|
|
storm::expressions::Variable var = manager->declareRationalVariable(parameter);
|
|
identifierMapping.emplace(var.getName(), var);
|
|
parser.setIdentifierMapping(identifierMapping);
|
|
STORM_LOG_TRACE("Added parameter: " << var.getName());
|
|
}
|
|
|
|
template<>
|
|
storm::RationalFunction ValueParser<storm::RationalFunction>::parseValue(std::string const& value) const {
|
|
storm::RationalFunction rationalFunction = evaluator.asRational(parser.parseFromString(value));
|
|
STORM_LOG_TRACE("Parsed expression: " << rationalFunction);
|
|
return rationalFunction;
|
|
}
|
|
|
|
template<typename ValueType>
|
|
ValueType ValueParser<ValueType>::parseValue(std::string const& value) const {
|
|
return parseNumber<ValueType>(value);
|
|
}
|
|
|
|
// Template instantiations.
|
|
template class ValueParser<double>;
|
|
template class ValueParser<storm::RationalNumber>;
|
|
template class ValueParser<storm::RationalFunction>;
|
|
|
|
} // namespace parser
|
|
} // namespace storm
|