Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
Block.cpp
Go to the documentation of this file.
2
3#include <iomanip>
4#include <iostream>
5
8
10
11namespace storm {
12namespace storage {
13namespace bisimulation {
14
15template<typename DataType>
17 std::size_t id)
18 : nextBlock(nextBlock), previousBlock(previousBlock), beginIndex(beginIndex), endIndex(endIndex), id(id), mData() {
19 if (nextBlock != nullptr) {
20 nextBlock->previousBlock = this;
21 }
22 if (previousBlock != nullptr) {
23 previousBlock->nextBlock = this;
24 }
25 data().resetMarkers(*this);
26 STORM_LOG_ASSERT(this->beginIndex < this->endIndex, "Unable to create block of illegal size.");
27}
28
29template<typename DataType>
30bool Block<DataType>::operator==(Block const& other) const {
31 return this == &other;
32}
33
34template<typename DataType>
35bool Block<DataType>::operator!=(Block const& other) const {
36 return this != &other;
37}
38
39template<typename DataType>
40void Block<DataType>::print(Partition<DataType> const& partition) const {
41 std::cout << "block [" << this << "] " << this->id << " from " << this->beginIndex << " to " << this->endIndex << " with data [" << this->data() << "]\n";
42 std::cout << "states ";
43 for (auto stateIt = partition.begin(*this), stateIte = partition.end(*this); stateIt != stateIte; ++stateIt) {
44 std::cout << *stateIt << ", ";
45 }
46 std::cout << '\n';
47}
48
49template<typename DataType>
51 this->beginIndex = beginIndex;
52 data().resetMarkers(*this);
53 STORM_LOG_ASSERT(beginIndex < endIndex, "Unable to resize block to illegal size.");
54}
55
56template<typename DataType>
58 this->endIndex = endIndex;
59 data().resetMarkers(*this);
60 STORM_LOG_ASSERT(beginIndex < endIndex, "Unable to resize block to illegal size.");
61}
62
63template<typename DataType>
64std::size_t Block<DataType>::getId() const {
65 return this->id;
66}
67
68template<typename DataType>
72
73template<typename DataType>
77
78template<typename DataType>
80 return *this->nextBlock;
81}
82
83template<typename DataType>
85 return this->nextBlock != nullptr;
86}
87
88template<typename DataType>
90 return this->nextBlock;
91}
92
93template<typename DataType>
95 return this->nextBlock;
96}
97
98template<typename DataType>
100 return *this->previousBlock;
101}
102
103template<typename DataType>
105 return this->previousBlock;
106}
107
108template<typename DataType>
110 return this->previousBlock;
111}
112
113template<typename DataType>
115 return this->previousBlock != nullptr;
116}
117
118template<typename DataType>
120 STORM_LOG_ASSERT(this->beginIndex < this->endIndex, "Block has negative size.");
121 STORM_LOG_ASSERT(!this->hasPreviousBlock() || this->getPreviousBlock().getNextBlockPointer() == this, "Illegal previous block.");
122 STORM_LOG_ASSERT(!this->hasNextBlock() || this->getNextBlock().getPreviousBlockPointer() == this, "Illegal next block.");
123 return true;
124}
125
126template<typename DataType>
128 return (this->endIndex - this->beginIndex);
129}
130
131template<typename DataType>
133 return mData;
134}
135
136template<typename DataType>
137DataType const& Block<DataType>::data() const {
138 return mData;
139}
140
141template<typename DataType>
143 mData.resetMarkers(*this);
144}
145
146template class Block<DeterministicBlockData>;
147
148} // namespace bisimulation
149} // namespace storage
150} // namespace storm
Block const & getPreviousBlock() const
Definition Block.cpp:99
Block const & getNextBlock() const
Definition Block.cpp:79
storm::storage::sparse::state_type getEndIndex() const
Definition Block.cpp:74
bool operator==(Block const &other) const
Definition Block.cpp:30
bool operator!=(Block const &other) const
Definition Block.cpp:35
std::size_t getNumberOfStates() const
Definition Block.cpp:127
void print(Partition< DataType > const &partition) const
Definition Block.cpp:40
storm::storage::sparse::state_type getBeginIndex() const
Definition Block.cpp:69
std::size_t getId() const
Definition Block.cpp:64
std::vector< storm::storage::sparse::state_type >::iterator begin(Block< DataType > const &block)
std::vector< storm::storage::sparse::state_type >::iterator end(Block< DataType > const &block)
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
LabParser.cpp.
Definition cli.cpp:18