Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Variable.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <functional>
5#include <memory>
6
9
10namespace storm {
11namespace expressions {
13class Expression;
14class Type;
15
16// This class captures a simple variable.
17class Variable {
18 public:
19 Variable();
20 ~Variable();
21
28 Variable(std::shared_ptr<ExpressionManager const> const& manager, uint_fast64_t index);
29
30 // Default-instantiate some copy/move construction/assignment.
31 Variable(Variable const& other) = default;
32 Variable& operator=(Variable const& other) = default;
33 Variable(Variable&& other) = default;
34 Variable& operator=(Variable&& other) = default;
35
42 bool operator==(Variable const& other) const;
43
50 bool operator!=(Variable const& other) const;
51
58 bool operator<(Variable const& other) const;
59
65 std::string const& getName() const;
66
72 Type const& getType() const;
73
80
86 ExpressionManager const& getManager() const;
87
93 uint_fast64_t getIndex() const;
94
100 uint_fast64_t getOffset() const;
101
107 bool hasBooleanType() const;
108
114 bool hasIntegerType() const;
115
121 bool hasBitVectorType() const;
122
128 bool hasRationalType() const;
129
135 bool hasNumericalType() const;
136
142 bool hasStringType() const;
143
144 private:
145 // The manager that is responsible for this variable.
146 ExpressionManager const* manager;
147
148 // The index of the variable.
149 uint_fast64_t index;
150};
151} // namespace expressions
152} // namespace storm
153
154namespace std {
155// Provide a hashing operator, so we can put variables in unordered collections.
156template<>
157struct hash<storm::expressions::Variable> {
158 std::size_t operator()(storm::expressions::Variable const& variable) const {
159 return std::hash<uint_fast64_t>()(variable.getIndex());
160 }
161};
162} // namespace std
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 hasStringType() const
Checks whether the variable is of string type.
Definition Variable.cpp:79
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
std::size_t operator()(storm::expressions::Variable const &variable) const
Definition Variable.h:158