SheafSystem  0.0.0.0
interval_set_iterator.h
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 #ifndef INTERVAL_SET_ITERATOR_H
22 #define INTERVAL_SET_ITERATOR_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef ANY_H
29 #include "SheafSystem/any.h"
30 #endif
31 
32 #ifndef INTERVAL_SET_H
33 #include "SheafSystem/interval_set.h"
34 #endif
35 
36 namespace sheaf
37 {
38 
42 class SHEAF_DLL_SPEC interval_set_iterator : public any
43 {
44 
45  // ===========================================================
47  // ===========================================================
49 
50 public:
51 
56 
62  interval_set_iterator(const interval_set& xset, bool xis_member_iterator);
63 
68 
73 
77  const interval_set& set() const;
78 
82  bool is_member_iterator() const;
83 
87  pod_type item() const;
88 
92  void next();
93 
97  bool is_done() const;
98 
102  void reset();
103 
104 protected:
105 
110 
114  void next_interval();
115 
119  bool is_member_interval() const;
120 
125 
130 
134  pod_type _item;
135 
139  pod_type _ub;
140 
145 
149  const map_type* _map;
150 
155 
159  map_iterator_type _map_itr;
160 
161 private:
162 
164 
165  // ===========================================================
167  // ===========================================================
169 
170 public:
171 
175  virtual bool is_ancestor_of(const any *other) const;
176 
181  virtual interval_set_iterator* clone() const;
182 
186  interval_set_iterator& operator=(const interval_set_iterator& xother);
187 
191  virtual bool operator==(const interval_set_iterator& xother) const;
192 
196  virtual bool invariant() const;
197 
198 protected:
199 
200 private:
201 
203 
204 };
205 
206 // ===========================================================
207 // NON-MEMBER FUNCTIONS
208 // ===========================================================
209 
210 } // namespace sheaf
211 
212 #endif // ifndef INTERVAL_SET_ITERATOR_H
An iterator over the integers in an interval_set.
Set of integers optimized for when the integers are concentrated in closed intervals.
Definition: interval_set.h:70
pod_type _ub
The upper bound of the current interval.
pod_index_type pod_type
The "plain old data" index type for this set.
Definition: interval_set.h:86
interval_set_iterator()
Default constructor; disabled.
std::map< pod_type, bool > map_type
The type of the interval map.
Definition: interval_set.h:198
interval_set::map_type map_type
Type of the interval map.
const map_type * _map
The interval map.
Abstract base class with useful features for all objects.
Definition: any.h:39
map_iterator_type _map_itr
The interval map iterator.
const interval_set * _set
The interval_set this is iterating over.
interval_set::map_iterator_type map_iterator_type
Type of the interval map iterator.
bool _is_member_iterator
True, if iterating over the members of the set.
bool operator==(const singly_linked_list< T, Alloc > &lhs, const singly_linked_list< T, Alloc > &rhs)
Checks if the contents of lhs and rhs are equal, that is, whether lhs.size() == rhs.size() and each element in lhs compares equal with the element in rhs at the same position.
interval_set::pod_type pod_type
The "plain old data" index type for this.
Namespace for the sheaves component of the sheaf system.
pod_type _item
The current integer in the iteration.
map_type::const_iterator map_iterator_type
The type of the interval map iterator.
Definition: interval_set.h:203