Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Variable.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/optional.hpp>
4#include <string>
5
9
10namespace storm {
11namespace jani {
12class Variable {
13 public:
17 Variable(std::string const& name, JaniType const& type, storm::expressions::Variable const& variable, storm::expressions::Expression const& init,
18 bool transient = false);
19
23 Variable(std::string const& name, JaniType const& type, storm::expressions::Variable const& variable);
24
28 std::unique_ptr<Variable> clone() const;
29
34
39
43 std::string const& getName() const;
44
48 void setName(std::string const& newName);
49
53 bool hasInitExpression() const;
54
62
66 void setInitExpression(storm::expressions::Expression const& initialExpression);
67
68 bool isTransient() const;
69
71 JaniType const& getType() const;
72
79
80 ~Variable();
81
85 void substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution, bool const substituteTranscendentalNumbers);
86
90 static std::shared_ptr<Variable> makeVariable(std::string const& name, JaniType const& type, storm::expressions::Variable const& variable,
91 boost::optional<storm::expressions::Expression> const& initValue, bool transient);
92 static std::shared_ptr<Variable> makeBasicTypeVariable(std::string const& name, BasicType::Type const& type, storm::expressions::Variable const& variable,
93 boost::optional<storm::expressions::Expression> const& initValue, bool transient);
94 static std::shared_ptr<Variable> makeBooleanVariable(std::string const& name, storm::expressions::Variable const& variable,
95 boost::optional<storm::expressions::Expression> const& initValue, bool transient);
96 static std::shared_ptr<Variable> makeIntegerVariable(std::string const& name, storm::expressions::Variable const& variable,
97 boost::optional<storm::expressions::Expression> const& initValue, bool transient);
98 static std::shared_ptr<Variable> makeRealVariable(std::string const& name, storm::expressions::Variable const& variable,
99 boost::optional<storm::expressions::Expression> const& initValue, bool transient);
100 static std::shared_ptr<Variable> makeBoundedVariable(std::string const& name, BoundedType::BaseType const& type,
101 storm::expressions::Variable const& variable,
102 boost::optional<storm::expressions::Expression> const& initValue, bool transient,
103 boost::optional<storm::expressions::Expression> const& lowerBound,
104 boost::optional<storm::expressions::Expression> const& upperBound);
105 static std::shared_ptr<Variable> makeBoundedIntegerVariable(std::string const& name, storm::expressions::Variable const& variable,
106 boost::optional<storm::expressions::Expression> const& initValue, bool transient,
107 boost::optional<storm::expressions::Expression> const& lowerBound,
108 boost::optional<storm::expressions::Expression> const& upperBound);
109 static std::shared_ptr<Variable> makeBoundedRealVariable(std::string const& name, storm::expressions::Variable const& variable,
110 boost::optional<storm::expressions::Expression> const& initValue, bool transient,
111 boost::optional<storm::expressions::Expression> const& lowerBound,
112 boost::optional<storm::expressions::Expression> const& upperBound);
113 static std::shared_ptr<Variable> makeArrayVariable(std::string const& name, JaniType const& baseType, storm::expressions::Variable const& variable,
114 boost::optional<storm::expressions::Expression> const& initValue, bool transient);
115 static std::shared_ptr<Variable> makeClockVariable(std::string const& name, storm::expressions::Variable const& variable,
116 boost::optional<storm::expressions::Expression> const& initValue, bool transient);
117 static std::shared_ptr<Variable> makeContinuousVariable(std::string const& name, storm::expressions::Variable const& variable,
118 boost::optional<storm::expressions::Expression> const& initValue, bool transient);
119
120 private:
122 std::string name;
124 std::unique_ptr<JaniType> type;
130 bool transient;
131};
132
133bool operator==(Variable const& lhs, Variable const& rhs);
134bool operator!=(Variable const& lhs, Variable const& rhs);
135
136} // namespace jani
137} // namespace storm
void setName(std::string const &newName)
Sets the name of the variable.
Definition Variable.cpp:38
void setExpressionVariable(storm::expressions::Variable const &newVariable)
Sets the associated expression variable.
Definition Variable.cpp:30
static std::shared_ptr< Variable > makeArrayVariable(std::string const &name, JaniType const &baseType, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient)
Definition Variable.cpp:150
static std::shared_ptr< Variable > makeContinuousVariable(std::string const &name, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient)
Definition Variable.cpp:160
static std::shared_ptr< Variable > makeIntegerVariable(std::string const &name, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient)
Definition Variable.cpp:115
static std::shared_ptr< Variable > makeRealVariable(std::string const &name, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient)
Definition Variable.cpp:120
static std::shared_ptr< Variable > makeBooleanVariable(std::string const &name, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient)
Definition Variable.cpp:110
static std::shared_ptr< Variable > makeBoundedIntegerVariable(std::string const &name, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient, boost::optional< storm::expressions::Expression > const &lowerBound, boost::optional< storm::expressions::Expression > const &upperBound)
Definition Variable.cpp:136
bool hasInitExpression() const
Retrieves whether an initial expression is set.
Definition Variable.cpp:46
std::unique_ptr< Variable > clone() const
Clones the variable.
Definition Variable.cpp:22
storm::expressions::Variable const & getExpressionVariable() const
Retrieves the associated expression variable.
Definition Variable.cpp:26
static std::shared_ptr< Variable > makeBoundedRealVariable(std::string const &name, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient, boost::optional< storm::expressions::Expression > const &lowerBound, boost::optional< storm::expressions::Expression > const &upperBound)
Definition Variable.cpp:143
JaniType & getType()
Definition Variable.cpp:67
storm::expressions::Expression getRangeExpression() const
Retrieves an expression characterizing the legal range of the variable.
Definition Variable.cpp:75
bool isTransient() const
Definition Variable.cpp:42
static std::shared_ptr< Variable > makeVariable(std::string const &name, JaniType const &type, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient)
Convenience functions to call the appropriate constructor and return a shared pointer to the variable...
Definition Variable.cpp:95
storm::expressions::Expression const & getInitExpression() const
Retrieves the initial expression Should only be called if an initial expression is set for this varia...
Definition Variable.cpp:50
void setInitExpression(storm::expressions::Expression const &initialExpression)
Sets the initial expression for this variable.
Definition Variable.cpp:55
static std::shared_ptr< Variable > makeBasicTypeVariable(std::string const &name, BasicType::Type const &type, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient)
Definition Variable.cpp:105
static std::shared_ptr< Variable > makeBoundedVariable(std::string const &name, BoundedType::BaseType const &type, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient, boost::optional< storm::expressions::Expression > const &lowerBound, boost::optional< storm::expressions::Expression > const &upperBound)
Definition Variable.cpp:125
std::string const & getName() const
Retrieves the name of the variable.
Definition Variable.cpp:34
void substitute(std::map< storm::expressions::Variable, storm::expressions::Expression > const &substitution, bool const substituteTranscendentalNumbers)
Substitutes all variables in all expressions according to the given substitution.
Definition Variable.cpp:59
static std::shared_ptr< Variable > makeClockVariable(std::string const &name, storm::expressions::Variable const &variable, boost::optional< storm::expressions::Expression > const &initValue, bool transient)
Definition Variable.cpp:155
bool operator!=(SynchronizationVector const &vector1, SynchronizationVector const &vector2)
bool operator==(SynchronizationVector const &vector1, SynchronizationVector const &vector2)
LabParser.cpp.
Definition cli.cpp:18