SheafSystem  0.0.0.0
member_record.h
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 
18 // Interface for class member_record
19 
20 #ifndef MEMBER_RECORD_H
21 #define MEMBER_RECORD_H
22 
23 #ifndef SHEAF_DLL_SPEC_H
24 #include "SheafSystem/sheaf_dll_spec.h"
25 #endif
26 
27 #ifndef BLOCK_H
28 #include "SheafSystem/block.h"
29 #endif
30 
31 #ifndef STD_BITSET_H
32 #include "SheafSystem/std_bitset.h"
33 #endif
34 
35 #ifndef STD_LIMITS_H
36 #include "SheafSystem/std_limits.h"
37 #endif
38 
39 #ifndef VARIABLE_LENGTH_RECORD_H
40 #include "SheafSystem/variable_length_record.h"
41 #endif
42 
43 namespace sheaf
44 {
45 
46 class member_record_set;
47 class poset_dof_iterator;
48 
54 class SHEAF_DLL_SPEC member_record : public variable_length_record
55 {
56  // ===========================================================
57  // MEMBER_RECORD FACET
58  // ===========================================================
59 
60 public:
61 
67 
71  member_record(const member_record& xother);
72 
76  virtual ~member_record();
77 
82 
87  bool is_resident() const;
88 
89 protected:
90 
91  // Default constructor.
92  // Default construction prohibited because scaffold must be initialized
93  // inline member_record() {} ;
94 
95 private:
96 
100  typedef std::bitset<std::numeric_limits<pod_index_type>::digits> toc_type;
101 
105  enum toc_bit_field_type
106  {
111 
112  FIRST_BIT, // Not used.
113  IS_JIM,
114  HAS_NAMES,
115  IS_INTERVAL,
116  HAS_PRIVATE_DATA,
117  HAS_DOF_TUPLE_IDS,
118  HAS_LOWER_COVER,
119  HAS_UPPER_COVER,
120  HAS_TOC_SUBPOSET_IDS,
121  HAS_SUBPOSET_IDS,
122  HAS_EQV_IDS,
123 
124  // Use the remaining bits to store subposet membership.
125 
126  SUBPOSET_BITS_BEGIN,
127  SUBPOSET_BITS_END = std::numeric_limits<pod_index_type>::digits - 1,
128  LAST_BIT = SUBPOSET_BITS_END // Not used.
129  };
130 
131  // Internal buffer
132 
133  toc_type _toc;
134  block<pod_index_type> _private_data;
135  block<pod_index_type> _dof_tuple_ids;
136  block<pod_index_type> _lower_cover;
137  block<pod_index_type> _upper_cover;
138  block<pod_index_type> _subposet_ids;
139  block<pod_index_type> _eqv_ids;
140  block<std::string> _names;
141 
142 
143  // External buffer layout:
144  // table of contents
145  // private data count
146  // private data
147  // dof tuple id count
148  // dof tuple ids
149  // lower cover count
150  // lower cover
151  // upper cover count
152  // upper cover
153  // subposet_ids count
154  // subposet_ids
155  // eqv_ids
156 
157  // Offsets into external buffer
158 
159  size_t _end_offset;
160 
164  scoped_index _mbr_id;
165 
169  record_index _ext_id;
170 
174  poset_state_handle* _poset;
175 
179  implicit_crg_interval* _interval;
180 
185  bool _is_resident;
186 
190  member_record_set& _host;
191 
195  member_record_set& host();
196 
200  const member_record_set& host() const;
201 
202  // ===========================================================
203  // EQUIVALENCE ITERATOR FACET
204  // ===========================================================
205 
206 public:
207 
211  void new_equivalence_iterator();
212 
216  void delete_equivalence_iterator();
217 
221  bool has_equivalence_iterator() const;
222 
223 protected:
224 
225 private:
226 
230  index_equivalence_iterator* _eqv_itr;
231 
235  index_equivalence_iterator& equivalence_iterator(const scoped_index& xrep_id);
236 
237  // ===========================================================
238  // EXTERNAL SIZE FACET
239  // ===========================================================
240 
241 public:
242 
246  size_type external_size(const scoped_index& xmbr_id);
247 
248 protected:
249 private:
250 
254  size_type private_data_external_size();
255 
256  // ///
257  // /// External size of id map field.
258  // ///
259  // size_type id_map_data_external_size();
260 
264  size_type dof_tuple_ids_external_size();
265 
269  size_type lower_cover_external_size();
270 
274  size_type upper_cover_external_size();
275 
279  size_type subposet_ids_external_size();
280 
284  size_type eqv_ids_external_size();
285 
289  size_type toc_external_size();
290 
291  // ===========================================================
292  // WRITE FACET
293  // ===========================================================
294 
295 public:
296 
300  void externalize(const scoped_index& xmbr_id, hvl_t* xhdf_buffer);
301 
302 private:
303 
307  void transfer_member_to_internal_buffer(const scoped_index& xmbr_id);
308 
312  void clear_internal_buffer();
313 
317  void transfer_member_to_toc(const scoped_index& xmbr_id);
318 
322  void transfer_interval_to_private_data(const scoped_index& xmbr_id);
323 
327  void transfer_member_to_dof_tuple_ids(const scoped_index& xmbr_id);
328 
332  void transfer_interval_to_dof_tuple_ids(const scoped_index& xmbr_id);
333 
337  void transfer_member_to_lower_cover(const scoped_index& xmbr_id);
338 
342  void transfer_member_to_upper_cover(const scoped_index& xmbr_id);
343 
347  void transfer_member_to_subposet_ids(const scoped_index& xmbr_id);
348 
352  void transfer_member_to_eqv_ids(const scoped_index& xmbr_id);
353 
357  void transfer_member_to_names(const scoped_index& xmbr_id);
358 
362  void transfer_interval_to_class_names(const scoped_index& xmbr_id);
363 
368  void convert_internal_buffer_to_external_buffer();
369 
373  virtual void initialize_external_buffer();
374 
378  void externalize_toc(size_t& xnext_field_offset);
379 
383  void externalize_private_data_ct(size_t& xnext_field_offset);
384 
388  void externalize_private_data(size_t& xnext_field_offset);
389 
393  void externalize_dof_tuple_ids_ct(size_t& xnext_field_offset);
394 
398  void externalize_dof_tuple_ids(size_t& xnext_field_offset);
399 
403  void externalize_lower_cover_ct(size_t& xnext_field_offset);
404 
408  void externalize_lower_cover(size_t& xnext_field_offset);
409 
413  void externalize_upper_cover_ct(size_t& xnext_field_offset);
414 
418  void externalize_upper_cover(size_t& xnext_field_offset);
419 
423  void externalize_subposet_ids_ct(size_t& xnext_field_offset);
424 
428  void externalize_subposet_ids(size_t& xnext_field_offset);
429 
433  void externalize_eqv_ids(size_t& xnext_field_offset);
434 
438  void transfer_external_buffer_to_HDF(hvl_t* xbuf);
439 
440  // ===========================================================
441  // READ FACET
442  // ===========================================================
443 
444 public:
445 
449  void internalize(hvl_t* xhdf_buffer, const scoped_index& xmbr_id);
450 
451 private:
452 
456  void transfer_HDF_to_external_buffer(hvl_t* xbuf);
457 
462  void convert_external_buffer_to_internal_buffer();
463 
467  void internalize_toc(size_t& xnext_field_offset);
468 
472  void internalize_private_data_ct(size_t& xnext_field_offset);
473 
477  void internalize_private_data(size_t& xnext_field_offset);
478 
482  void internalize_dof_tuple_ids_ct(size_t& xnext_field_offset);
483 
487  void internalize_dof_tuple_ids(size_t& xnext_field_offset);
488 
492  void internalize_lower_cover_ct(size_t& xnext_field_offset);
493 
497  void internalize_lower_cover(size_t& xnext_field_offset);
498 
502  void internalize_upper_cover_ct(size_t& xnext_field_offset);
503 
507  void internalize_upper_cover(size_t& xnext_field_offset);
508 
512  void internalize_subposet_ids_ct(size_t& xnext_field_offset);
513 
517  void internalize_subposet_ids(size_t& xnext_field_offset);
518 
522  void internalize_eqv_ids(size_t& xnext_field_offset);
523 
527  void transfer_internal_buffer_to_member(const scoped_index& xmbr_id);
528 
532  void transfer_toc_to_member(const scoped_index& xmbr_id);
533 
537  void transfer_private_data_to_interval(const scoped_index& xmbr_id);
538 
542  void transfer_dof_tuple_ids_to_interval(const scoped_index& xmbr_id);
543 
547  void transfer_dof_tuple_ids_to_member(const scoped_index& xmbr_id);
548 
552  const scoped_index& new_row_dof_tuple(pod_index_type xext_dof_tuple_pod);
553 
557  void transfer_lower_cover_to_member(const scoped_index& xmbr_id);
558 
562  void transfer_upper_cover_to_member(const scoped_index& xmbr_id);
563 
567  void new_member(pod_index_type xmbr_id);
568 
572  void transfer_subposet_ids_to_member(const scoped_index& xmbr_id);
573 
577  void transfer_eqv_ids_to_member(const scoped_index& xmbr_id);
578 
582  void transfer_names_to_member(const scoped_index& xmbr_id);
583 
584  // ===========================================================
585  // VARIABLE_LENGTH_RECORD FACET
586  // ===========================================================
587 
591  inline pod_index_type* int_buf()
592  {
593  return reinterpret_cast<pod_index_type*>(buf());
594  };
595 
596  // ===========================================================
597  // RECORD FACET
598  // ===========================================================
599 
600  // ===========================================================
601  // ANY FACET
602  // ===========================================================
603 
604 public:
605 
611  virtual member_record* clone() const;
612 
616  virtual bool invariant() const;
617 
621  virtual bool is_ancestor_of(const any* other) const;
622 
623 };
624 
625 } // namespace sheaf
626 
627 #endif // ifndef MEMBER_RECORD_H
628 
629 
630 
631 
632 
633 
A client handle for a general, abstract partially order set.
The general variable length record wrapper/adapter for transferring data between the kernel and the i...
Abstract implementation of crg_interval for an interval of implicit cover relation graph members...
Abstract base class with useful features for all objects.
Definition: any.h:39
A record_set containing records of type member_record.
A record buffer for transferring member data between the kernel and the i/o subsystem.
Definition: member_record.h:54
Struct representing the closed interval [_begin, _end].
Definition: interval_set.h:48
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
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.
An iterator over members of an id equivalence class.