SheafSystem  0.0.0.0
hash_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 HASH_INDEX_SPACE_STATE_H
22 #define HASH_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 SCATTERED_INSERTION_INDEX_SPACE_STATE_H
33 #include "SheafSystem/scattered_insertion_index_space_state.h"
34 #endif
35 
36 #ifndef STD_UNORDERED_MAP_H
37 #include "SheafSystem/std_unordered_map.h"
38 #endif
39 
40 namespace sheaf
41 {
42 
43 class hash_index_space_handle;
44 class hash_index_space_state;
45 class hash_index_space_iterator;
46 
55 {
56 
57  friend class hash_index_space_iterator;
58  friend class namespace_poset;
59  friend SHEAF_DLL_SPEC size_t deep_size(const hash_index_space_state& xn, bool xinclude_shallow);
60 
61  // ===========================================================
63  // ===========================================================
65 
66 public:
67 
74  static hash_index_space_handle new_space(index_space_family& xid_spaces,
75  const std::string& xname,
76  bool xis_persistent,
77  size_type xcapacity);
78 
85  static hash_index_space_handle new_space(index_space_family& xid_spaces,
86  pod_type xid,
87  const std::string& xname,
88  bool xis_persistent,
89  size_type xcapacity);
90 
91 protected:
92 
93 private:
94 
96 
97 
98  // ===========================================================
100  // ===========================================================
102 
103 public:
104 
105 protected:
106 
111 
116 
120  virtual ~hash_index_space_state();
121 
122 private:
123 
125 
126 
127  // ===========================================================
129  // ===========================================================
131 
132 public:
133 
134 protected:
135 
136 private:
137 
139 
140  // ===========================================================
142  // ===========================================================
144 
145 public:
146 
148 
152  virtual void update_extrema();
153 
157  virtual void reserve(size_type xcapacity);
158 
162  virtual size_type capacity() const;
163 
164 protected:
165 
166 private:
167 
169 
170 
171  // ===========================================================
173  // ===========================================================
175 
176 public:
177 
178 protected:
179 
183  virtual void map_rep_insert_entry(pod_type xdomain_id, pod_type xrange_id);
184 
188  virtual void map_rep_push_back(pod_type xrange_id);
189 
195  virtual void map_rep_push(index_space_iterator& xitr, pod_type xrange_id);
196 
202  virtual size_type map_rep_remove_entry(pod_type xid, bool xis_range_id);
203 
208  virtual void map_rep_remove_entry(index_space_iterator& xitr);
209 
213  virtual void map_rep_clear();
214 
218  virtual void map_rep_gather();
219 
223  typedef unordered::unordered_map<pod_type, pod_type> map_type;
224 
228  typedef map_type to_domain_type;
229 
233  to_domain_type _to_domain;
234 
238  typedef map_type to_range_type;
239 
243  to_range_type _to_range;
244 
245 private:
246 
248 
249 
250  // ===========================================================
252  // ===========================================================
254 
255 public:
256 
260  virtual bool operator==(const explicit_index_space_state& xother) const;
261 
265  virtual size_type deep_size(bool xinclude_shallow) const;
266 
267 protected:
268 
272  virtual hash_index_space_state& operator=(const explicit_index_space_state& xother);
273 
274 private:
275 
277 
278 
279  // ===========================================================
281  // ===========================================================
283 
284 public:
285 
289  virtual bool contains(pod_type xid) const;
290 
294  virtual bool contains_unglued_hub(pod_type xid) const;
295 
300  virtual bool contains(pod_type xid, pod_type xhub_id) const;
301 
305  virtual pod_type pod(pod_type xid) const;
306 
310  virtual pod_type unglued_hub_pod(pod_type xid) const;
311 
312 protected:
313 
314 private:
315 
317 
318 
319  // ===========================================================
321  // ===========================================================
323 
324 public:
325 
329  static size_type handle_pool_ct();
330 
334  static size_type handle_pool_deep_size();
335 
339  virtual index_space_handle& get_id_space() const;
340 
344  virtual void release_id_space(index_space_handle& xid_space) const;
345 
350  virtual bool allocated_id_space(const index_space_handle& xid_space) const;
351 
352 protected:
353 
354 private:
355 
359  static list_pool<hash_index_space_handle>& handles();
360 
362 
363 
364  // ===========================================================
366  // ===========================================================
368 
369 public:
370 
374  static size_type iterator_pool_ct();
375 
379  static size_type iterator_pool_deep_size();
380 
384  virtual index_space_iterator& get_iterator() const;
385 
389  virtual void release_iterator(index_space_iterator& xitr) const;
390 
395  virtual bool allocated_iterator(const index_space_iterator& xitr) const;
396 
397 protected:
398 
399 private:
400 
404  static list_pool<hash_index_space_iterator>& iterators();
405 
407 
408 
409  // ===========================================================
411  // ===========================================================
413 
414 public:
415 
419  virtual const std::string& class_name() const;
420 
424  virtual hash_index_space_state* clone() const;
425 
426 protected:
427 
428 private:
429 
433  static bool make_prototype();
434 
436 
437 
438  // ===========================================================
440  // ===========================================================
442 
443 public:
444 
448  virtual bool is_ancestor_of(const any *other) const;
449 
453  virtual bool invariant() const;
454 
455 protected:
456 
457 private:
458 
460 
461 };
462 
463 // ===========================================================
464 // NON-MEMBER FUNCTIONS
465 // ===========================================================
466 
470 SHEAF_DLL_SPEC
471 size_t deep_size(const hash_index_space_state& xn, bool xinclude_shallow = true);
472 
473 } // end namespace sheaf
474 
475 #endif // ifndef HASH_INDEX_SPACE_STATE_H
map_type to_range_type
The type of the domain id to range id map.
An abstract iterator over the ids of an id space.
The default name space; a poset which contains other posets as members.
An hash map implementation of class scattered_insertion_index_space_handle. This representation is in...
An implementation of class explicit_index_space_state that supports either gathered or scattered inse...
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
map_type to_domain_type
The type of the range id to domain 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.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
to_domain_type _to_domain
The representation of the range id to domain id map.
An hash map implementation of class scattered_insertion_index_space_state. This representation is int...
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.
to_range_type _to_range
The representation of the domain id to range id map.
pod_index_type pod_type
The "plain old data" index type for this.
Namespace for the sheaves component of the sheaf system.
An iterator over an id space in which the equivalence between the ids in the space and the hub id spa...
hash_index_space_state(const hash_index_space_state &xother)
Copy constructor; disabled.
Factory and container for a family of id spaces.
unordered::unordered_map< pod_type, pod_type > map_type
The type of the range id to domain id map.
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