SheafSystem  0.0.0.0
array_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 ARRAY_INDEX_SPACE_STATE_H
22 #define ARRAY_INDEX_SPACE_STATE_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef AUTO_BLOCK_H
29 #include "SheafSystem/auto_block.h"
30 #endif
31 
32 #ifndef LIST_POOL_H
33 #include "SheafSystem/list_pool.h"
34 #endif
35 
36 #ifndef SCATTERED_INSERTION_INDEX_SPACE_STATE_H
37 #include "SheafSystem/scattered_insertion_index_space_state.h"
38 #endif
39 
40 #ifndef STD_UNORDERED_MAP_H
41 #include "SheafSystem/std_unordered_map.h"
42 #endif
43 
44 namespace sheaf
45 {
46 
47 class array_index_space_handle;
48 class array_index_space_state;
49 class array_index_space_iterator;
50 
61 {
62 
63  friend class array_index_space_iterator;
64  friend class namespace_poset;
65  friend SHEAF_DLL_SPEC size_t deep_size(const array_index_space_state& xn, bool xinclude_shallow);
66 
67  // ===========================================================
69  // ===========================================================
71 
72 public:
73 
80  static array_index_space_handle new_space(index_space_family& xid_spaces,
81  const std::string& xname,
82  bool xis_persistent,
83  size_type xcapacity);
84 
91  static array_index_space_handle new_space(index_space_family& xid_spaces,
92  pod_type xid,
93  const std::string& xname,
94  bool xis_persistent,
95  size_type xcapacity);
96 
97 protected:
98 
99 private:
100 
102 
103 
104  // ===========================================================
106  // ===========================================================
108 
109 public:
110 
111 protected:
112 
117 
122 
126  virtual ~array_index_space_state();
127 
128 private:
129 
131 
132 
133  // ===========================================================
135  // ===========================================================
137 
138 public:
139 
140 protected:
141 
142 private:
143 
145 
146 
147  // ===========================================================
149  // ===========================================================
151 
152 public:
153 
155 
159  virtual void update_extrema();
160 
164  virtual void reserve(size_type xcapacity);
165 
169  virtual size_type capacity() const;
170 
171 protected:
172 
176  virtual void update_extrema_after_remove();
177 
178 private:
179 
181 
182  // ===========================================================
184  // ===========================================================
186 
187 public:
188 
189 protected:
190 
194  virtual void map_rep_insert_entry(pod_type xdomain_id, pod_type xrange_id);
195 
199  virtual void map_rep_push_back(pod_type xrange_id);
200 
206  virtual void map_rep_push(index_space_iterator& xitr, pod_type xrange_id);
207 
213  virtual size_type map_rep_remove_entry(pod_type xid, bool xis_range_id);
214 
219  virtual void map_rep_remove_entry(index_space_iterator& xitr);
220 
224  virtual void map_rep_clear();
225 
229  virtual void map_rep_gather();
230 
234  typedef unordered::unordered_map<pod_type, pod_type> to_domain_type;
235 
239  to_domain_type _to_domain;
240 
245 
249  to_range_type _to_range;
250 
251 private:
252 
254 
255 
256  // ===========================================================
258  // ===========================================================
260 
261 public:
262 
266  virtual bool operator==(const explicit_index_space_state& xother) const;
267 
271  virtual size_type deep_size(bool xinclude_shallow) const;
272 
273 protected:
274 
278  virtual array_index_space_state& operator=(const explicit_index_space_state& xother);
279 
280 private:
281 
283 
284 
285  // ===========================================================
287  // ===========================================================
289 
290 public:
291 
295  virtual bool contains(pod_type xid) const;
296 
300  virtual bool contains_unglued_hub(pod_type xid) const;
301 
306  virtual bool contains(pod_type xid, pod_type xhub_id) const;
307 
311  virtual pod_type pod(pod_type xid) const;
312 
316  virtual pod_type unglued_hub_pod(pod_type xid) const;
317 
318 protected:
319 
320 private:
321 
323 
324 
325  // ===========================================================
327  // ===========================================================
329 
330 public:
331 
335  static size_type handle_pool_ct();
336 
340  static size_type handle_pool_deep_size();
341 
345  virtual index_space_handle& get_id_space() const;
346 
350  virtual void release_id_space(index_space_handle& xid_space) const;
351 
356  virtual bool allocated_id_space(const index_space_handle& xid_space) const;
357 
358 protected:
359 
360 private:
361 
365  static list_pool<array_index_space_handle>& handles();
366 
368 
369 
370  // ===========================================================
372  // ===========================================================
374 
375 public:
376 
380  static size_type iterator_pool_ct();
381 
385  static size_type iterator_pool_deep_size();
386 
390  virtual index_space_iterator& get_iterator() const;
391 
395  virtual void release_iterator(index_space_iterator& xitr) const;
396 
401  virtual bool allocated_iterator(const index_space_iterator& xitr) const;
402 
403 protected:
404 
405 private:
406 
410  static list_pool<array_index_space_iterator>& iterators();
411 
413 
414 
415  // ===========================================================
417  // ===========================================================
419 
420 public:
421 
425  virtual const std::string& class_name() const;
426 
430  virtual array_index_space_state* clone() const;
431 
432 protected:
433 
434 private:
435 
439  static bool make_prototype();
440 
442 
443 
444  // ===========================================================
446  // ===========================================================
448 
449 public:
450 
454  virtual bool is_ancestor_of(const any *other) const;
455 
459  virtual bool invariant() const;
460 
461 protected:
462 
463 private:
464 
466 
467 };
468 
469 // ===========================================================
470 // NON-MEMBER FUNCTIONS
471 // ===========================================================
472 
476 SHEAF_DLL_SPEC
477 size_t deep_size(const array_index_space_state& xn, bool xinclude_shallow = true);
478 
479 } // end namespace sheaf
480 
481 #endif // ifndef ARRAY_INDEX_SPACE_STATE_H
unordered::unordered_map< pod_type, pod_type > to_domain_type
The type of the range id to domain id map.
An abstract iterator over the ids of an id space.
The default name space; a poset which contains other posets as members.
auto_block< pod_type, invalid_block_initialization_policy< pod_type > > to_range_type
The type of the domain id to range id map.
An implementation of class explicit_index_space_state that supports either gathered or scattered inse...
array_index_space_state(const array_index_space_state &xother)
Copy constructor; disabled.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
A contiguously allocated array of items of type T with size information and automatic resizing...
Definition: auto_block.h:122
An array implementation of class scattered_insertion_index_space_state. This representation is intend...
to_range_type _to_range
The representation of the domain id to range id 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...
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.
An array implementation of class scattered_insertion_index_space_handle. This representation is inten...
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.
An iterator over an id space in which the equivalence between the ids in the space and the hub id spa...
Namespace for the sheaves component of the sheaf system.
Factory and container for a family of id spaces.
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
to_domain_type _to_domain
The representation of the range id to domain id map.