SheafSystem  0.0.0.0
index_space_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_SPACE_ITERATOR_H
22 #define INDEX_SPACE_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 POD_TYPES_H
33 #include "SheafSystem/pod_types.h"
34 #endif
35 
36 namespace sheaf
37 {
38 
39 class hub_index_space_handle;
40 class index_space_collection;
41 class index_space_family;
42 class index_space_handle;
43 
47 class SHEAF_DLL_SPEC index_space_iterator : public any
48 {
49 
50  friend class explicit_index_space_state;
51  friend class index_space_collection;
52  friend class index_space_handle;
53 
54  // ===========================================================
56  // ===========================================================
58 
59 public:
60 
65 
69  virtual ~index_space_iterator();
70 
74  virtual index_space_iterator& operator=(const index_space_iterator& xother);
75 
79  virtual bool operator==(const index_space_iterator& xother) const;
80 
85  virtual index_space_iterator* clone() const = 0;
86 
87 protected:
88 
93 
98 
99 private:
100 
102 
103 
104  // ===========================================================
106  // ===========================================================
108 
109 public:
110 
114  virtual void next() = 0;
115 
119  bool is_done() const;
120 
124  virtual void reset() = 0;
125 
129  void force_is_done();
130 
131 protected:
132 
136  bool _is_done;
137 
138 private:
139 
141 
142 
143  // ===========================================================
145  // ===========================================================
147 
148 public:
149 
153  pod_type pod() const;
154 
159  pod_type hub_pod() const;
160 
164  pod_type unglued_hub_pod() const;
165 
169  pod_type glued_hub_pod() const;
170 
171 protected:
172 
176  void invalidate_ids();
177 
181  pod_type _pod;
182 
186  pod_type _hub_pod;
187 
188 private:
189 
191 
192 
193  // ===========================================================
195  // ===========================================================
197 
198 public:
199 
203  const index_space_family& id_spaces() const;
204 
208  const hub_index_space_handle& hub_id_space() const;
209 
210 protected:
211 
212 private:
213 
215 
216 
217  // ===========================================================
219  // ===========================================================
221 
222 public:
223 
227  virtual const index_space_collection& host() const = 0;
228 
232  virtual pod_type index() const = 0;
233 
237  std::string name() const;
238 
242  virtual bool is_attached() const = 0;
243 
247  void attach_to(const index_space_family& xid_spaces, pod_type xindex);
248 
252  void attach_to(const index_space_family& xid_spaces, const std::string& xname);
253 
257  virtual void attach_to(pod_type xindex) = 0;
258 
262  void attach_to(const std::string& xname);
263 
267  void attach_to(const index_space_handle& xid_space);
268 
273  virtual void attach_to(const index_space_collection& xhost,
274  pod_type xlocal_id) = 0;
275 
279  virtual void detach() = 0;
280 
285  bool conforms_to_state(const index_space_family& xid_spaces,
286  pod_type xindex) const;
287 
292  bool conforms_to_state(const index_space_family& xid_spaces,
293  const std::string& xname) const;
294 
299  bool conforms_to_state(pod_type xid) const;
300 
305  bool conforms_to_state(const std::string& xname) const;
306 
311  virtual bool conforms_to_state(const index_space_collection& xhost,
312  pod_type xlocal_id) const = 0;
313 
314 protected:
315 
316 private:
317 
319 
320 
321  // ===========================================================
323  // ===========================================================
325 
326 public:
327 
331  virtual bool is_ancestor_of(const any *other) const;
332 
336  virtual bool invariant() const;
337 
338 protected:
339 
340 private:
341 
343 
344 };
345 
346 // ===========================================================
347 // NON-MEMBER FUNCTIONS
348 // ===========================================================
349 
353 SHEAF_DLL_SPEC
354 size_t deep_size(const index_space_iterator& xn, bool xinclude_shallow = true);
355 
356 } // namespace sheaf
357 
358 #endif // ifndef INDEX_SPACE_ITERATOR_H
An abstract iterator over the ids of an id space.
bool _is_done
True if the iteration is finished.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
An implementation of class sum_index_space_handle that has a primary sum id space state...
Abstract base class with useful features for all objects.
Definition: any.h:39
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
pod_type _hub_pod
The current hub id in the iteration.
A collection of id space states. This is a virtual class with provides an interface for accessing the...
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.
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.
pod_type _pod
The current id in the iteration.
Factory and container for a family of id spaces.
pod_index_type pod_type
The "plain old data" index type for this.