Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ArrayVariableReplacementInformation.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/variant.hpp>
4#include <cstdint>
5#include <vector>
9
10namespace storm {
11namespace generator {
13 public:
14 ArrayVariableReplacementInformation(std::vector<ArrayVariableReplacementInformation>&& children);
15 ArrayVariableReplacementInformation(uint64_t informationIndex);
16
17 bool isInformationIndex() const;
18 uint64_t getInformationIndex() const;
19 uint64_t getNumberOfChildren() const;
20 ArrayVariableReplacementInformation const& getChild(uint64_t arrayAccessIndex) const;
21 uint64_t getVariableInformationIndex(std::vector<uint64_t> arrayIndexVector) const;
22
23 private:
24 boost::variant<uint64_t, std::vector<ArrayVariableReplacementInformation>> data;
25};
26
27template<typename InfoType>
29 InfoType const& relevantVariableInfo) {
30 if (replacement.isVariable()) {
31 auto const& replVar = replacement.getVariable().getExpressionVariable();
32 uint64_t index = 0;
33 for (auto const& info : relevantVariableInfo) {
34 if (info.variable == replVar) {
35 return index;
36 }
37 ++index;
38 }
39 STORM_LOG_THROW(false, storm::exceptions::UnexpectedException,
40 "Could not find a basic variable for replacement of array variable " << replVar.getName() << " .");
41 } else {
42 std::vector<ArrayVariableReplacementInformation> result;
43 result.reserve(replacement.size());
44 for (auto const& child : replacement.getReplacements()) {
45 result.push_back(convertArrayReplacement(child, relevantVariableInfo));
46 }
47 return result;
48 }
49}
50
51} // namespace generator
52} // namespace storm
uint64_t getVariableInformationIndex(std::vector< uint64_t > arrayIndexVector) const
ArrayVariableReplacementInformation const & getChild(uint64_t arrayAccessIndex) const
std::vector< Replacement > const & getReplacements() const
storm::jani::Variable const & getVariable() const
std::size_t size() const
equivalent to .at(i_1).at(i_2). ... .at(i_n) if indices = {i_1,i_2, ... i_n}
storm::expressions::Variable const & getExpressionVariable() const
Retrieves the associated expression variable.
Definition Variable.cpp:26
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
ArrayVariableReplacementInformation convertArrayReplacement(typename storm::jani::ArrayEliminatorData::Replacement const &replacement, InfoType const &relevantVariableInfo)
LabParser.cpp.
Definition cli.cpp:18