Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
StateBlock.h
Go to the documentation of this file.
1#ifndef STORM_STORAGE_BLOCK_H_
2#define STORM_STORAGE_BLOCK_H_
3
4#include <ostream>
5
6#include <boost/container/container_fwd.hpp>
7
11
12namespace storm {
13namespace storage {
14
15// Typedef the most common state container.
17
18std::ostream& operator<<(std::ostream& out, FlatSetStateContainer const& block);
19
21 public:
23 typedef container_type::value_type value_type;
24 static_assert(std::is_same<value_type, sparse::state_type>::value, "Illegal value type of container.");
25 typedef container_type::iterator iterator;
26 typedef container_type::const_iterator const_iterator;
27
28 // Default constructors.
29 StateBlock() = default;
30 StateBlock(StateBlock const& other) = default;
31#ifndef WINDOWS
32 StateBlock(StateBlock&& other) = default;
33 StateBlock& operator=(StateBlock const& other) = default;
34 StateBlock& operator=(StateBlock&& other) = default;
35#endif
43 template<typename InputIterator>
44 StateBlock(InputIterator first, InputIterator last, bool sortedAndUnique = false) {
45 if (sortedAndUnique) {
46 this->states = container_type(boost::container::ordered_unique_range_t(), first, last);
47 } else {
48 this->states = container_type(first, last);
49 }
50 }
51
57 StateBlock(std::initializer_list<sparse::state_type> list) : states(list.begin(), list.end()) {
58 // Intentionally left empty.
59 }
60
67 bool operator==(StateBlock const& other) const {
68 return this->states == other.states;
69 }
70
77
83 const_iterator begin() const;
84
91 return this->begin();
92 };
93
99 iterator end();
100
106 const_iterator end() const;
107
114 return this->end();
115 };
116
122 bool containsState(value_type const& state) const;
123
129 void insert(value_type const& state);
130
136 iterator insert(container_type::const_iterator iterator, value_type const& state);
137
143 void erase(value_type const& state);
144
150 std::size_t size() const;
151
157 bool empty() const;
158
164 container_type const& getStates() const;
165
166 private:
167 // The container that holds the states.
168 container_type states;
169};
170
178std::ostream& operator<<(std::ostream& out, StateBlock const& block);
179} // namespace storage
180} // namespace storm
181
182#endif /* STORM_STORAGE_BLOCK_H_ */
std::size_t size() const
Retrieves the number of states in this SCC.
container_type::iterator iterator
Definition StateBlock.h:25
iterator begin()
Returns an iterator to the states in this SCC.
Definition StateBlock.cpp:5
StateBlock & operator=(StateBlock const &other)=default
StateBlock & operator=(StateBlock &&other)=default
bool containsState(value_type const &state) const
Retrieves whether the given state is in the SCC.
const_iterator cbegin() const
Returns a const iterator to the states in this SCC.
Definition StateBlock.h:90
StateBlock(std::initializer_list< sparse::state_type > list)
Constructs a state block from the given initializer list.
Definition StateBlock.h:57
FlatSetStateContainer container_type
Definition StateBlock.h:22
void insert(value_type const &state)
Inserts the given element into this SCC.
void erase(value_type const &state)
Removes the given element from this SCC.
StateBlock(StateBlock const &other)=default
iterator end()
Returns an iterator that points one past the end of the states in this SCC.
const_iterator cend() const
Returns a const iterator that points one past the end of the states in this SCC.
Definition StateBlock.h:113
container_type::value_type value_type
Definition StateBlock.h:23
bool operator==(StateBlock const &other) const
Checks whether the two state blocks contain exactly the same states.
Definition StateBlock.h:67
container_type const & getStates() const
Retrieves the set of states contained in the StateBlock.
container_type::const_iterator const_iterator
Definition StateBlock.h:26
StateBlock(InputIterator first, InputIterator last, bool sortedAndUnique=false)
Creates a state block and inserts all elements in the given range.
Definition StateBlock.h:44
StateBlock(StateBlock &&other)=default
bool empty() const
Retrieves whether this SCC is empty.
boost::container::flat_set< Key, std::less< Key >, boost::container::new_allocator< Key > > FlatSet
Redefinition of flat_set was needed, because from Boost 1.70 on the default allocator is set to void.
Definition BoostTypes.h:13
storm::storage::FlatSet< sparse::state_type > FlatSetStateContainer
Definition StateBlock.h:16
std::ostream & operator<<(std::ostream &out, ParameterRegion< ParametricType > const &region)
LabParser.cpp.
Definition cli.cpp:18