7 changed files with 95 additions and 18 deletions
-
11src/storage/expressions/BaseExpression.h
-
20src/storage/expressions/Expression.cpp
-
28src/storage/expressions/Expression.h
-
12src/storage/expressions/ExpressionVisitor.h
-
21src/storage/expressions/SimpleValuation.cpp
-
4src/storage/expressions/SimpleValuation.h
-
17src/storage/expressions/SubstitutionVisitor.h
@ -1,13 +1,29 @@ |
|||
#include <map>
|
|||
#include <unordered_map>
|
|||
|
|||
#include "src/storage/expressions/Expression.h"
|
|||
|
|||
namespace storm { |
|||
namespace expressions { |
|||
virtual Expression Expression::operator+(Expression const& other) { |
|||
Expression::Expression(std::unique_ptr<BaseExpression>&& expressionPtr) : expressionPtr(std::move(expressionPtr)) { |
|||
// Intentionally left empty.
|
|||
} |
|||
|
|||
template<template<typename... Arguments> class MapType> |
|||
Expression Expression::substitute(MapType<std::string, Expression> const& identifierToExpressionMap) const { |
|||
SubstitutionVisitor visitor; |
|||
return visitor.substitute(this->getBaseExpression(), identifierToExpressionMap); |
|||
} |
|||
|
|||
Expression Expression::operator+(Expression const& other) { |
|||
return Expression(this->getBaseExpression() + other.getBaseExpression()); |
|||
} |
|||
|
|||
BaseExpression const& getBaseExpression() const { |
|||
BaseExpression const& Expression::getBaseExpression() const { |
|||
return *this->expressionPtr; |
|||
} |
|||
|
|||
template Expression Expression::substitute<std::map>(std::map<std::string, storm::expressions::Expression> const&) const; |
|||
template Expression Expression::substitute<std::unordered_map>(std::unordered_map<std::string, storm::expressions::Expression> const&) const; |
|||
} |
|||
} |
@ -0,0 +1,12 @@ |
|||
#ifndef STORM_STORAGE_EXPRESSIONS_EXPRESSIONVISITOR_H_ |
|||
#define STORM_STORAGE_EXPRESSIONS_EXPRESSIONVISITOR_H_ |
|||
|
|||
namespace storm { |
|||
namespace expressions { |
|||
class ExpressionVisitor { |
|||
|
|||
}; |
|||
} |
|||
} |
|||
|
|||
#endif /* STORM_STORAGE_EXPRESSIONS_EXPRESSIONVISITOR_H_ */ |
@ -0,0 +1,17 @@ |
|||
#ifndef STORM_STORAGE_EXPRESSIONS_SUBSTITUTIONVISITOR_H_ |
|||
#define STORM_STORAGE_EXPRESSIONS_SUBSTITUTIONVISITOR_H_ |
|||
|
|||
#include "src/storage/expressions/BaseExpression.h" |
|||
#include "src/storage/expressions/ExpressionVisitor.h" |
|||
|
|||
namespace storm { |
|||
namespace expressions { |
|||
class SubstitutionVisitor : public ExpressionVisitor { |
|||
public: |
|||
template<template<typename... Arguments> class MapType> |
|||
Expression substitute(BaseExpression const* expression, MapType<std::string, Expression> const& identifierToExpressionMap); |
|||
}; |
|||
} |
|||
} |
|||
|
|||
#endif /* STORM_STORAGE_EXPRESSIONS_SUBSTITUTIONVISITOR_H_ */ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue