SheafSystem  0.0.0.0
list_index_space_state.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 LIST_INDEX_SPACE_STATE_H
22 #define LIST_INDEX_SPACE_STATE_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef LIST_POOL_H
29 #include "SheafSystem/list_pool.h"
30 #endif
31 
32 #ifndef GATHERED_INSERTION_INDEX_SPACE_STATE_H
33 #include "SheafSystem/gathered_insertion_index_space_state.h"
34 #endif
35 
36 #ifndef STD_LIST_H
37 #include "SheafSystem/std_list.h"
38 #endif
39 
40 namespace sheaf
41 {
42 
43 class list_index_space_handle;
44 class list_index_space_state;
45 class list_index_space_iterator;
46 
50 SHEAF_DLL_SPEC
51 size_t deep_size(const list_index_space_state& xn, bool xinclude_shallow);
52 
61 {
62 
63  friend class list_index_space_iterator;
64  friend class namespace_poset;
65  friend SHEAF_DLL_SPEC size_t deep_size(const list_index_space_state& xn, bool xinclude_shallow);
66 
67  // ===========================================================
69  // ===========================================================
71 
72 public:
73 
80  static list_index_space_handle new_space(index_space_family& xid_spaces,
81  const std::string& xname,
82  bool xis_persistent);
83 
90  static list_index_space_handle new_space(index_space_family& xid_spaces,
91  pod_type xid,
92  const std::string& xname,
93  bool xis_persistent);
94 
95 protected:
96 
97 private:
98 
100 
101 
102  // ===========================================================
104  // ===========================================================
106 
107 public:
108 
112  void reverse(bool xupdate_extrema);
113 
118  pod_type front() const;
119 
124  pod_type back() const;
125 
130  void push_front(pod_type xhub_id);
131 
135  void replace_range_id(pod_type xold_range_id, pod_type xnew_range_id);
136 
137 protected:
138 
143 
148 
152  virtual ~list_index_space_state();
153 
154 
155 private:
156 
158 
159 
160  // ===========================================================
162  // ===========================================================
164 
165 public:
166 
168 
172  virtual void update_extrema();
173 
177  virtual void reserve(size_type xcapacity);
178 
182  virtual size_type capacity() const;
183 
184 protected:
185 
186 private:
187 
189 
190 
191  // ===========================================================
193  // ===========================================================
195 
196 public:
197 
201  typedef std::list<pod_type> to_range_type;
202 
209  to_range_type& to_range();
210 
217  const to_range_type& to_range() const;
218 
219 protected:
220 
224  virtual void map_rep_push_back(pod_type xrange_id);
225 
231  virtual void map_rep_push(index_space_iterator& xitr, pod_type xrange_id);
232 
238  virtual size_type map_rep_remove_entry(pod_type xid, bool xis_range_id);
239 
244  virtual void map_rep_remove_entry(index_space_iterator& xitr);
245 
249  virtual void map_rep_clear();
250 
254  virtual void map_rep_gather();
255 
259  to_range_type _to_range;
260 
264  pod_type _capacity;
265 
270  to_range_type::iterator to_range_itr(pod_type xid, bool xis_range_id);
271 
276  to_range_type::const_iterator to_range_const_itr(pod_type xid, bool xis_range_id) const;
277 
278 
279 private:
280 
282 
283 
284  // ===========================================================
286  // ===========================================================
288 
289 public:
290 
294  virtual bool operator==(const explicit_index_space_state& xother) const;
295 
299  virtual size_type deep_size(bool xinclude_shallow) const;
300 
301 protected:
302 
306  virtual list_index_space_state& operator=(const explicit_index_space_state& xother);
307 
308 private:
309 
311 
312 
313  // ===========================================================
315  // ===========================================================
317 
318 public:
319 
323  virtual bool contains(pod_type xid) const;
324 
328  virtual bool contains_unglued_hub(pod_type xid) const;
329 
334  virtual bool contains(pod_type xid, pod_type xhub_id) const;
335 
339  virtual pod_type pod(pod_type xid) const;
340 
344  virtual pod_type unglued_hub_pod(pod_type xid) const;
345 
346 protected:
347 
348 private:
349 
351 
352 
353  // ===========================================================
355  // ===========================================================
357 
358 public:
359 
363  static size_type handle_pool_ct();
364 
368  static size_type handle_pool_deep_size();
369 
373  virtual index_space_handle& get_id_space() const;
374 
378  virtual void release_id_space(index_space_handle& xid_space) const;
379 
384  virtual bool allocated_id_space(const index_space_handle& xid_space) const;
385 
386 protected:
387 
388 private:
389 
393  static list_pool<list_index_space_handle>& handles();
394 
396 
397 
398  // ===========================================================
400  // ===========================================================
402 
403 public:
404 
408  static size_type iterator_pool_ct();
409 
413  static size_type iterator_pool_deep_size();
414 
418  virtual index_space_iterator& get_iterator() const;
419 
423  virtual void release_iterator(index_space_iterator& xitr) const;
424 
429  virtual bool allocated_iterator(const index_space_iterator& xitr) const;
430 
431 protected:
432 
433 private:
434 
438  static list_pool<list_index_space_iterator>& iterators();
439 
441 
442 
443  // ===========================================================
445  // ===========================================================
447 
448 public:
449 
453  virtual const std::string& class_name() const;
454 
458  virtual list_index_space_state* clone() const;
459 
460 protected:
461 
462 private:
463 
467  static bool make_prototype();
468 
470 
471 
472  // ===========================================================
474  // ===========================================================
476 
477 public:
478 
482  virtual bool is_ancestor_of(const any *other) const;
483 
487  virtual bool invariant() const;
488 
489 protected:
490 
491 private:
492 
494 
495 };
496 
497 // ===========================================================
498 // NON-MEMBER FUNCTIONS
499 // ===========================================================
500 
501 } // end namespace sheaf
502 
503 #endif // ifndef LIST_INDEX_SPACE_STATE_H
std::list< pod_type > to_range_type
The type of the domain id to range id map.
An abstract iterator over the ids of an id space.
An list implementation of class gathered_insertion_index_space_state. This representation is intended...
The default name space; a poset which contains other posets as members.
An map implementation of class scattered_insertion_index_space_handle. This representation is intende...
to_range_type _to_range
The representation of the domain id to range id map.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
pod_type _capacity
The capacity of this map.
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...
An iterator over an id space in which the equivalence between the ids in the space and the hub id spa...
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.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
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.
list_index_space_state(const list_index_space_state &xother)
Copy constructor; disabled.
Namespace for the sheaves component of the sheaf system.
Factory and container for a family of id spaces.
An implementation of class explicit_index_space_state that supports gathered insertion of new members...
A reallocated pool of objects of type T. Objects in the pool are either allocated or stored in a free...
Definition: list_pool.h:42