Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Variable.h
Go to the documentation of this file.
1#ifndef STORM_STORAGE_EXPRESSIONS_VARIABLE_H_
2#define STORM_STORAGE_EXPRESSIONS_VARIABLE_H_
3
4#include <cstdint>
5#include <functional>
6#include <memory>
7
10
11namespace storm {
12namespace expressions {
13class ExpressionManager;
14class Expression;
15class Type;
16
17// This class captures a simple variable.
18class Variable {
19 public:
20 Variable();
21 ~Variable();
22
29 Variable(std::shared_ptr<ExpressionManager const> const& manager, uint_fast64_t index);
30
31 // Default-instantiate some copy/move construction/assignment.
32 Variable(Variable const& other) = default;
33 Variable& operator=(Variable const& other) = default;
34 Variable(Variable&& other) = default;
35 Variable& operator=(Variable&& other) = default;
36
43 bool operator==(Variable const& other) const;
44
51 bool operator!=(Variable const& other) const;
52
59 bool operator<(Variable const& other) const;
60
66 std::string const& getName() const;
67
73 Type const& getType() const;
74
81
87 ExpressionManager const& getManager() const;
88
94 uint_fast64_t getIndex() const;
95
101 uint_fast64_t getOffset() const;
102
108 bool hasBooleanType() const;
109
115 bool hasIntegerType() const;
116
122 bool hasBitVectorType() const;
123
129 bool hasRationalType() const;
130
136 bool hasNumericalType() const;
137
138 private:
139 // The manager that is responsible for this variable.
140 ExpressionManager const* manager;
141
142 // The index of the variable.
143 uint_fast64_t index;
144};
145} // namespace expressions
146} // namespace storm
147
148namespace std {
149// Provide a hashing operator, so we can put variables in unordered collections.
150template<>
151struct hash<storm::expressions::Variable> {
152 std::size_t operator()(storm::expressions::Variable const& variable) const {
153 return std::hash<uint_fast64_t>()(variable.getIndex());
154 }
155};
156} // namespace std
157
158#endif /* STORM_STORAGE_EXPRESSIONS_VARIABLE_H_ */
This class is responsible for managing a set of typed variables and all expressions using these varia...
bool hasBooleanType() const
Checks whether the variable is of boolean type.
Definition Variable.cpp:59
Variable(Variable &&other)=default
Variable & operator=(Variable &&other)=default
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
Variable(Variable const &other)=default
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
Variable & operator=(Variable const &other)=default
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
LabParser.cpp.
Definition cli.cpp:18