Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Variable.cpp
Go to the documentation of this file.
3
4namespace storm {
5namespace expressions {
6Variable::Variable() : manager(nullptr) {
7 // Intentionally left empty.
8}
9
10Variable::Variable(std::shared_ptr<ExpressionManager const> const& manager, uint_fast64_t index) : manager(manager.get()), index(index) {
11 // Intentionally left empty.
12}
13
15 // Intentionally left empty.
16}
17
18bool Variable::operator==(Variable const& other) const {
19#ifndef NDEBUG
20 return &this->getManager() == &other.getManager() && index == other.index;
21#else
22 return index == other.index;
23#endif
24}
25
26bool Variable::operator!=(Variable const& other) const {
27 return !(*this == other);
28}
29
30bool Variable::operator<(Variable const& other) const {
31 return this->getIndex() < other.getIndex();
32}
33
37
38uint_fast64_t Variable::getIndex() const {
39 return index;
40}
41
42uint_fast64_t Variable::getOffset() const {
43 return this->getManager().getOffset(index);
44}
45
46std::string const& Variable::getName() const {
47 return this->getManager().getVariableName(index);
48}
49
50Type const& Variable::getType() const {
51 return this->getManager().getVariableType(index);
52}
53
55 STORM_LOG_ASSERT(manager != nullptr, "The variable does not have a manager.");
56 return *manager;
57}
58
60 return this->getType().isBooleanType();
61}
62
64 return this->getType().isIntegerType();
65}
66
68 return this->getType().isBitVectorType();
69}
70
72 return this->getType().isRationalType();
73}
74
76 return this->getType().isNumericalType();
77}
78} // namespace expressions
79} // namespace storm
This class is responsible for managing a set of typed variables and all expressions using these varia...
Type const & getVariableType(uint_fast64_t index) const
Retrieves the type of the variable with the given index.
uint_fast64_t getOffset(uint_fast64_t index) const
Retrieves the offset of the variable with the given index within the group of equally typed variables...
std::string const & getVariableName(uint_fast64_t index) const
Retrieves the name of the variable with the given index.
bool isBooleanType() const
Checks whether this type is a boolean type.
Definition Type.cpp:178
bool isIntegerType() const
Checks whether this type is an integral type.
Definition Type.cpp:182
bool isNumericalType() const
Checks whether this type is a numerical type.
Definition Type.cpp:190
bool isRationalType() const
Checks whether this type is a rational type.
Definition Type.cpp:214
bool isBitVectorType() const
Checks whether this type is a bitvector type.
Definition Type.cpp:186
bool hasBooleanType() const
Checks whether the variable is of boolean type.
Definition Variable.cpp:59
ExpressionManager const & getManager() const
Retrieves the manager responsible for this variable.
Definition Variable.cpp:54
Type const & getType() const
Retrieves the type of the variable.
Definition Variable.cpp:50
uint_fast64_t getIndex() const
Retrieves the index of the variable.
Definition Variable.cpp:38
storm::expressions::Expression getExpression() const
Retrieves an expression that represents the variable.
Definition Variable.cpp:34
bool hasBitVectorType() const
Checks whether the variable is of a bit vector type.
Definition Variable.cpp:67
uint_fast64_t getOffset() const
Retrieves the offset of the variable in the group of all equally typed variables.
Definition Variable.cpp:42
bool operator==(Variable const &other) const
Checks the two variables for equality.
Definition Variable.cpp:18
bool operator<(Variable const &other) const
Checks whether the variable appears earlier in the total ordering of variables.
Definition Variable.cpp:30
bool hasNumericalType() const
Checks whether the variable is of numerical type.
Definition Variable.cpp:75
bool operator!=(Variable const &other) const
Checks the two variables for inequality.
Definition Variable.cpp:26
bool hasIntegerType() const
Checks whether the variable is of integral type.
Definition Variable.cpp:63
bool hasRationalType() const
Checks whether the variable is of rational type.
Definition Variable.cpp:71
std::string const & getName() const
Retrieves the name of the variable.
Definition Variable.cpp:46
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
LabParser.cpp.
Definition cli.cpp:18