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