SheafSystem  0.0.0.0
index_equivalence_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 INDEX_EQUIVALENCE_ITERATOR_H
22 #define INDEX_EQUIVALENCE_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 INDEX_EQUIVALENCE_CLASS_H
33 #include "SheafSystem/index_equivalence_class.h"
34 #endif
35 
36 #ifndef SCOPED_INDEX_H
37 #include "SheafSystem/scoped_index.h"
38 #endif
39 
40 namespace sheaf
41 {
42 
43 class index_space_family;
44 
48 class SHEAF_DLL_SPEC index_equivalence_iterator : public any
49 {
50 
51  // ===========================================================
53  // ===========================================================
55 
56 public:
57 
64 
72  pod_index_type xrep_id,
73  bool xonly_persistent,
74  bool xsort_ids);
75 
83  const scoped_index& xrep_id,
84  bool xonly_persistent,
85  bool xsort_ids);
86 
94  bool xonly_persistent,
95  bool xsort_ids);
96 
100  virtual ~index_equivalence_iterator();
101 
105  const index_space_family& id_spaces() const;
106 
110  pod_index_type rep_id() const;
111 
115  void rep_id(scoped_index& result) const;
116 
120  bool only_persistent() const;
121 
125  bool is_sorted() const;
126 
130  void put_rep_id(pod_index_type xrep_id);
131 
135  void put_rep_id(const scoped_index& xrep_id);
136 
140  const member_type& item() const;
141 
145  bool is_done() const;
146 
150  size_type ct() const;
151 
155  void next();
156 
160  void reset();
161 
162 protected:
163 
167  typedef index_equivalence_class::list_type::const_iterator iterator_type;
168 
173 
177  const index_space_family* _id_spaces;
178 
183 
188 
193 
198 
202  iterator_type _itr;
203 
207  iterator_type _end;
208 
212  member_type _item;
213 
217  bool _is_done;
218 
219 private:
220 
222 
223 
224  // ===========================================================
226  // ===========================================================
228 
229 public:
230 
234  virtual bool is_ancestor_of(const any *other) const;
235 
240  virtual index_equivalence_iterator* clone() const;
241 
245  index_equivalence_iterator& operator=(const index_equivalence_iterator& xother);
246 
250  virtual bool invariant() const;
251 
252 protected:
253 
254 private:
255 
257 
258 };
259 
260 // ===========================================================
261 // NON-MEMBER FUNCTIONS
262 // ===========================================================
263 
264 } // namespace sheaf
265 
266 #endif // ifndef INDEX_EQUIVALENCE_ITERATOR_H
pod_index_type _rep_id
The representative of this equivalence class.
index_equivalence_class::member_type member_type
The member type for the equivalence id list. The first value in the pair is the index of the id space...
bool _is_sorted
True, if the ids are sorted in increasing space id order.
index_equivalence_iterator()
Default constructor; disabled.
std::pair< pod_type, pod_type > member_type
The member type for the equivalence id list. The first value in the pair is the index of the id space...
Abstract base class with useful features for all objects.
Definition: any.h:39
index_equivalence_class::list_type::const_iterator iterator_type
The type of iterator for the equivalence id list.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
iterator_type _itr
The current equivalence list iterator.
iterator_type _end
The end of the current list begin iterated over.
Data structure containing the id equivalence class for ab id space family. This class is used as a te...
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
Namespace for the sheaves component of the sheaf system.
bool _only_persistent
True, if only persistent id spaces should be iterated over.
bool _is_done
True if iteration is finished.
An iterator over members of an id equivalence class.
index_equivalence_class _equivalence_class
The equivalence class to iterate over.
Factory and container for a family of id spaces.
member_type _item
The current equivalence class member.