SMT-RAT
24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
Expression.cpp
Go to the documentation of this file.
1
/*
2
#include "Expression.h"
3
4
#include "ExpressionContent.h"
5
#include "ExpressionPool.h"
6
7
namespace smtrat {
8
namespace expression {
9
10
11
12
template<typename T>
13
bool Expression::isType() const {
14
return boost::get<T>(&mContent->content) != nullptr;
15
//return boost::apply_visitor(ExpressionTypeChecker<T>(), mContent->content);
16
}
17
template<typename T>
18
const T& Expression::type() const {
19
return boost::get<T>(mContent->content);
20
}
21
22
Expression::Expression(carl::Variable::Arg var):
23
mContent(ExpressionPool::getInstance().create(var))
24
{}
25
Expression::Expression(ITEType _type, Expression&& _if, Expression&& _then, Expression&& _else):
26
mContent(ExpressionPool::getInstance().create(_type, std::move(_if), std::move(_then), std::move(_else)))
27
{}
28
Expression::Expression(QuantifierType _type, std::vector<carl::Variable>&& _variables, Expression&& _expression):
29
mContent(ExpressionPool::getInstance().create(_type, std::move(_variables), std::move(_expression)))
30
{}
31
Expression::Expression(UnaryType _type, Expression&& _expression):
32
mContent(ExpressionPool::getInstance().create(_type, std::move(_expression)))
33
{}
34
Expression::Expression(BinaryType _type, Expression&& _lhs, Expression&& _rhs):
35
mContent(ExpressionPool::getInstance().create(_type, std::move(_lhs), std::move(_rhs)))
36
{}
37
Expression::Expression(NaryType _type, Expressions&& _expressions):
38
mContent(ExpressionPool::getInstance().create(_type, std::move(_expressions)))
39
{}
40
Expression::Expression(NaryType _type, const std::initializer_list<Expression>& _expressions):
41
mContent(ExpressionPool::getInstance().create(_type, _expressions))
42
{}
43
44
const ExpressionContent* Expression::getNegationPtr() const {
45
return mContent->negation;
46
}
47
48
bool Expression::isITE() const {
49
return isType<ITEExpression>();
50
}
51
const ITEExpression& Expression::getITE() const {
52
return getType<ITEExpression>();
53
}
54
55
bool Expression::isQuantifier() const {
56
return isType<QuantifierExpression>();
57
}
58
const QuantifierExpression& Expression::getQuantifier() const {
59
return getType<QuantifierExpression>();
60
}
61
62
bool Expression::isUnary() const {
63
return isType<UnaryExpression>();
64
}
65
const UnaryExpression& Expression::getUnary() const {
66
return getType<UnaryExpression>();
67
}
68
69
bool Expression::isBinary() const {
70
return isType<BinaryExpression>();
71
}
72
const BinaryExpression& Expression::getBinary() const {
73
return getType<BinaryExpression>();
74
}
75
76
bool Expression::is_nary() const {
77
return isType<NaryExpression>();
78
}
79
const NaryExpression& Expression::getNary() const {
80
return getType<NaryExpression>();
81
}
82
83
bool Expression::operator==(const Expression& expr) const {
84
return mContent->id == expr.mContent->id;
85
}
86
bool Expression::operator<(const Expression& expr) const {
87
return mContent->id < expr.mContent->id;
88
}
89
bool Expression::operator!=(const Expression& expr) const {
90
return mContent->id != expr.mContent->id;
91
}
92
93
std::ostream& operator<<(std::ostream& os, const Expression& expr) {
94
return os << expr.getContent();
95
}
96
97
}
98
}
99
*/
smtrat-expressions
Expression.cpp
Generated by
1.9.1