3#include <boost/functional/hash.hpp>
15std::size_t
const TypeIfThenElse = 0xa1;
16std::size_t
const TypeBinaryBooleanFunction = 0xb2;
17std::size_t
const TypeBinaryNumericalFunction = 0xb3;
18std::size_t
const TypeBinaryRelation = 0xb4;
19std::size_t
const TypeVariable = 0xc5;
20std::size_t
const TypeUnaryBooleanFunction = 0xd6;
21std::size_t
const TypeUnaryNumericalFunction = 0xd7;
22std::size_t
const TypeBooleanLiteral = 0xe8;
23std::size_t
const TypeIntegerLiteral = 0xe9;
24std::size_t
const TypeRationalLiteral = 0xea;
25std::size_t
const TypePredicate = 0xfb;
28std::size_t hashValue(T
const& value) {
29 return boost::hash<T>{}(value);
35 return boost::any_cast<std::size_t>(expression.
accept(*
this, boost::any{}));
38std::size_t HashVisitor::hashExpression(
BaseExpression const& expression) {
39 return boost::any_cast<std::size_t>(expression.
accept(*
this, boost::any{}));
43 std::size_t result = TypeIfThenElse;
44 boost::hash_combine(result, hashExpression(*expression.
getCondition()));
51 std::size_t result = TypeBinaryBooleanFunction;
53 boost::hash_combine(result, hashExpression(*expression.
getFirstOperand()));
59 std::size_t result = TypeBinaryNumericalFunction;
61 boost::hash_combine(result, hashExpression(*expression.
getFirstOperand()));
67 std::size_t result = TypeBinaryRelation;
69 boost::hash_combine(result, hashExpression(*expression.
getFirstOperand()));
75 std::size_t result = TypeVariable;
83 std::size_t result = TypeUnaryBooleanFunction;
85 boost::hash_combine(result, hashExpression(*expression.
getOperand()));
90 std::size_t result = TypeUnaryNumericalFunction;
92 boost::hash_combine(result, hashExpression(*expression.
getOperand()));
97 std::size_t result = TypeBooleanLiteral;
98 boost::hash_combine(result, hashValue(expression.
getValue()));
103 std::size_t result = TypeIntegerLiteral;
104 boost::hash_combine(result, hashValue(expression.
getValue()));
109 std::size_t result = TypeRationalLiteral;
110 boost::hash_combine(result, hashValue(expression.
getValue()));
115 std::size_t result = TypePredicate;
117 for (uint_fast64_t i = 0; i < expression.
getArity(); ++i) {
118 boost::hash_combine(result, hashExpression(*expression.
getOperand(i)));
The base class of all expression classes.
virtual boost::any accept(ExpressionVisitor &visitor, boost::any const &data) const =0
Accepts the given visitor by calling its visit method.
OperatorType getOperatorType() const
Retrieves the operator associated with the expression.
std::shared_ptr< BaseExpression const > const & getSecondOperand() const
Retrieves the second operand of the expression.
std::shared_ptr< BaseExpression const > const & getFirstOperand() const
Retrieves the first operand of the expression.
OperatorType getOperatorType() const
Retrieves the operator associated with the expression.
RelationType getRelationType() const
Retrieves the relation associated with the expression.
bool getValue() const
Retrieves the value of the boolean literal.
boost::any accept(ExpressionVisitor &visitor, boost::any const &data) const
Accepts the given visitor.
virtual boost::any visit(IfThenElseExpression const &expression, boost::any const &data) override
std::size_t hash(storm::expressions::Expression const &expression)
Computes the hash of the given expression.
std::shared_ptr< BaseExpression const > getElseExpression() const
Retrieves the else expression of the if-then-else expression.
std::shared_ptr< BaseExpression const > getCondition() const
Retrieves the condition expression of the if-then-else expression.
std::shared_ptr< BaseExpression const > getThenExpression() const
Retrieves the then expression of the if-then-else expression.
int_fast64_t getValue() const
Retrieves the value of the integer literal.
The base class of all binary expressions.
virtual std::shared_ptr< BaseExpression const > getOperand(uint_fast64_t operandIndex) const override
Retrieves the given operand from the expression.
PredicateType getPredicateType() const
Retrieves the relation associated with the expression.
virtual uint_fast64_t getArity() const override
Returns the arity of the expression.
storm::RationalNumber getValue() const
Retrieves the value of the double literal.
OperatorType getOperatorType() const
Retrieves the operator associated with this expression.
virtual std::shared_ptr< BaseExpression const > getOperand(uint_fast64_t operandIndex) const override
Retrieves the given operand from the expression.
OperatorType getOperatorType() const
Retrieves the operator associated with this expression.
Variable const & getVariable() const
Retrieves the variable associated with this expression.
uint_fast64_t getIndex() const
Retrieves the index of the variable.