SheafSystem  0.0.0.0
attributes_record_set.cc
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 // Implementation for class attributes_record_set
19 
20 #include "SheafSystem/attributes_record_set.h"
21 
22 #include "SheafSystem/assert_contract.h"
23 #include "SheafSystem/error_message.h"
24 #include "SheafSystem/interval_index_space_handle.h"
25 #include "SheafSystem/namespace_poset.h"
26 #include "SheafSystem/poset_bounds.h"
27 #include "SheafSystem/poset_bounds_descriptor.h"
28 #include "SheafSystem/sheaf_file.h"
29 
30 using namespace std;
31 
32 //#define DIAGNOSTIC_OUTPUT
33 //#undef DIAGNOSTIC_OUTPUT
34 
35 namespace
36 {
37  //
38  // The rank of the dataspace for the data set.
39  //
40  const int DATASPACE_RANK = 1;
41 
42  //
43  // The number of HDF records
44  //
45  const int RECORD_BUFFER_UB = 12;
46 }
47 
48 
49 
50 // PUBLIC MEMBER FUNCTIONS
51 
52 // CANONICAL MEMBERS
53 
57  : record_set(xother),
58  _general_attributes(xother._general_attributes),
59  _table_dof_tuple(xother._table_dof_tuple),
60  _member_names(xother._member_names),
61  _member_class_names(xother._member_class_names),
62  _subposet_names(xother._subposet_names),
63  _id_space_names(xother._id_space_names),
64  _dof_tuple_types(xother._dof_tuple_types),
65  _dof_tuple_class_names(xother._dof_tuple_class_names),
66  _dof_tuple_schema_versions(xother._dof_tuple_schema_versions),
67  _dof_tuple_schema_ids(xother._dof_tuple_schema_ids),
68  _dof_tuple_col_bounds(xother._dof_tuple_col_bounds),
69  _dof_tuple_domain_offsets(xother._dof_tuple_domain_offsets)
70 {
71 
72  // Preconditions:
73 
74 
75  // Body:
76 
77  not_implemented();
78 
79  // Postconditions:
80 
81  ensure(invariant());
82 }
83 
84 
85 
89 clone() const
90 {
91  attributes_record_set* result;
92 
93  // Preconditions:
94 
95  // Body:
96 
97  result = new attributes_record_set(*this);
98 
99  // Postconditions:
100 
101  ensure(result != 0);
102  ensure(is_same_type(result));
103 
104  // Exit:
105 
106  return result;
107 }
108 
109 
113 {
114 
115  // Preconditions:
116 
117  // Body:
118 
119  delete [] _ext_dataspace_dims;
120  delete [] _hdf_bufs;
121 
122  // Postconditions:
123 
124  // Exit:
125 
126  return;
127 }
128 
129 
131 bool
133 invariant() const
134 {
135  bool result = true;
136 
137  // Preconditions:
138 
139  // Body:
140 
141  // Must satisfy base class invariant
142 
143  result = result && record_set::invariant();
144 
145  if(invariant_check())
146  {
147  // Prevent recursive calls to invariant
148 
150 
151  invariance(record_buffer_ub() == RECORD_BUFFER_UB);
152 
153  // Finished, turn invariant checking back on.
154 
156  }
157 
158  // Postconditions:
159 
160  // Exit
161 
162  return result;
163 }
164 
166 bool
168 is_ancestor_of(const any* other) const
169 {
170 
171  // Preconditions:
172 
173  require(other != 0);
174 
175  // Body:
176 
177  // True if other conforms to this
178 
179  bool result = dynamic_cast<const attributes_record_set*>(other) != 0;
180 
181  // Postconditions:
182 
183  return result;
184 
185 }
186 
187 
188 
189 // ATTRIBUTES_RECORD_SET INTERFACE
190 
193 attributes_record_set(const sheaf_file& xfile, const poset_scaffold& xscaffold)
194  : record_set(xfile, RECORD_BUFFER_UB, xscaffold),
195  _general_attributes(const_cast<poset_scaffold&>(xscaffold)),
196  _table_dof_tuple(const_cast<poset_scaffold&>(xscaffold)),
197  _member_names(const_cast<poset_scaffold&>(xscaffold)),
198  _member_class_names(const_cast<poset_scaffold&>(xscaffold)),
199  _subposet_names(const_cast<poset_scaffold&>(xscaffold)),
200  _id_space_names(const_cast<poset_scaffold&>(xscaffold)),
201  _dof_tuple_types(const_cast<poset_scaffold&>(xscaffold)),
202  _dof_tuple_class_names(const_cast<poset_scaffold&>(xscaffold)),
203  _dof_tuple_schema_versions(const_cast<poset_scaffold&>(xscaffold)),
204  _dof_tuple_schema_ids(const_cast<poset_scaffold&>(xscaffold)),
205  _dof_tuple_col_bounds(const_cast<poset_scaffold&>(xscaffold)),
206  _dof_tuple_domain_offsets(const_cast<poset_scaffold&>(xscaffold))
207 {
208 
209  // Preconditions:
210 
211  require(xfile.is_open());
212  require(!xscaffold.structure().name().empty());
213 
214  // Body:
215 
216  // _name has been initialized to poset name in record_set;
217  // add attributes dataset suffix to it.
218 
219  _name = data_set_name(scaffold().structure().name());
220  _alias = data_set_alias(scaffold().structure().name());
221 
222  _ext_dataspace_rank = DATASPACE_RANK;
223  _ext_dataspace_dims = new hsize_t[DATASPACE_RANK];
224 
225  // Create the HDF record buffer
226 
227  _hdf_bufs = new hdf_buf_type[_record_buffer_ub];
228 
229  // Create the interior dataspace to describe the HDF record buffer.
230 
231  hsize_t linit_dims[DATASPACE_RANK];
232  linit_dims[0] = _record_buffer_ub;
233 
234  _int_dataspace_hdf_id = H5Screate_simple(DATASPACE_RANK, linit_dims, NULL);
235  if(_int_dataspace_hdf_id < 0)
236  {
237  post_fatal_error_message("can't create interior data space");
238  }
239 
240  // No records are active yet.
241 
242  _record_buffer_ct = 0;
243 
244  // Postconditions:
245 
246  ensure(invariant());
247  ensure(name() == data_set_name(scaffold().structure().name()));
248  ensure(alias() == data_set_alias(scaffold().structure().name()));
249  ensure(!is_open());
250  ensure(record_buffer_ub() == RECORD_BUFFER_UB);
251  ensure(record_buffer_ct() == 0);
252 }
253 
254 const std::string&
256 suffix() const
257 {
258  // cout << endl << "Entering attributes_record_set::suffix." << endl;
259 
260  // Preconditions:
261 
262 
263  // Body:
264 
265  static const string result(".attributes");
266 
267  // Postconditions:
268 
269 
270  // Exit:
271 
272  // cout << "Leaving attributes_record_set::suffix." << endl;
273  return result;
274 }
275 
276 
278 void
281 {
282  // Preconditions:
283 
284  require(!scaffold().structure().is_external() ? scaffold().structure().state_is_read_write_accessible() : true);
285 
286  // Body:
287 
288  hdf_buf_type* lhdf_buf = _hdf_bufs;
289 
290  // Read all the records.
291 
292  read_selection();
293 
294  // Internalize the general attributes record.
295 
296  _general_attributes.internalize(lhdf_buf);
297 
298  // Read the table dof tuple and create the poset if needed.
299 
300  lhdf_buf++;
301  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
302 
303  _table_dof_tuple.internalize(lhdf_buf);
304 
305  // Populate the member names table.
306 
307  lhdf_buf++;
308  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
309 
310  _member_names.internalize(lhdf_buf);
311 
312  // Populate the member class names table.
313 
314  lhdf_buf++;
315  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
316 
317  _member_class_names.internalize(lhdf_buf);
318 
319  // Create the subposets and populate the subposet names table.
320 
321  lhdf_buf++;
322  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
323 
324  _subposet_names.internalize(lhdf_buf);
325 
326  // Create the id soaces and populate the id space names table.
327 
328  lhdf_buf++;
329  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
330 
331  _id_space_names.internalize(lhdf_buf);
332 
333  // Populate the dof tuple types table.
334 
335  lhdf_buf++;
336  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
337 
338  _dof_tuple_types.internalize(lhdf_buf);
339 
340  // Populate the dof tuple class names table.
341 
342  lhdf_buf++;
343  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
344 
345  _dof_tuple_class_names.internalize(lhdf_buf);
346 
347  // Populate the dof tuple schema versions table.
348 
349  lhdf_buf++;
350  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
351 
352  _dof_tuple_schema_versions.internalize(lhdf_buf);
353 
354  // Populate the dof tuple schema ids table.
355 
356  lhdf_buf++;
357  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
358 
359  _dof_tuple_schema_ids.internalize(lhdf_buf);
360 
361  // Populate the dof tuple col bounds table.
362 
363  lhdf_buf++;
364  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
365 
366  _dof_tuple_col_bounds.internalize(lhdf_buf);
367 
368  // Populate the dof tuple domain offsets table.
369 
370  lhdf_buf++;
371  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
372 
373  _dof_tuple_domain_offsets.internalize(lhdf_buf);
374 
375  // We're finished with the hdf record buffer;
376  // let hdf do garbage collection.
377 
378  herr_t lstatus =
379  H5Dvlen_reclaim(_int_data_type_hdf_id, _int_dataspace_hdf_id, H5P_DEFAULT, _hdf_bufs);
380 
381  if(lstatus < 0)
382  {
383  post_warning_message("Unable to reclaim memory from HDF variable length data.");
384  }
385 
386  // Postconditions:
387 
388  ensure(!scaffold().structure().is_external());
389  ensure(scaffold().structure().state_is_read_write_accessible());
390 
391  // Exit
392 
393  return;
394 }
395 
396 
398 void
401 {
402  // Preconditions:
403 
404  require(scaffold().structure().state_is_read_accessible());
405 
406  // Body:
407 
408  hdf_buf_type* lhdf_buf = _hdf_bufs;
409 
410  // Externalize the general attributes record.
411 
412  _general_attributes.externalize(lhdf_buf);
413 
414  // Externalize the table dof tuple.
415 
416  lhdf_buf++;
417  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
418 
419  _table_dof_tuple.externalize(lhdf_buf);
420 
421  // Externalize the member names table.
422 
423  lhdf_buf++;
424  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
425 
426  _member_names.externalize(lhdf_buf);
427 
428  // Externalize the member class names table.
429 
430  lhdf_buf++;
431  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
432 
433  _member_class_names.externalize(lhdf_buf);
434 
435  // Externalize the subposet names table.
436 
437  lhdf_buf++;
438  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
439 
440  _subposet_names.externalize(lhdf_buf);
441 
442  // Externalize the id space names table.
443 
444  lhdf_buf++;
445  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
446 
447  _id_space_names.externalize(lhdf_buf);
448 
449  // Externalize the dof tuple types table.
450 
451  lhdf_buf++;
452  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
453 
454  _dof_tuple_types.externalize(lhdf_buf);
455 
456  // Externalize the dof tuple class names table.
457 
458  lhdf_buf++;
459  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
460 
461  _dof_tuple_class_names.externalize(lhdf_buf);
462 
463  // Externalize the dof tuple schema versions table.
464 
465  lhdf_buf++;
466  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
467 
468  _dof_tuple_schema_versions.externalize(lhdf_buf);
469 
470  // Externalize the dof tuple schema ids table.
471 
472  lhdf_buf++;
473  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
474 
475  _dof_tuple_schema_ids.externalize(lhdf_buf);
476 
477  // Externalize the dof tuple col bounds table.
478 
479  lhdf_buf++;
480  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
481 
482  _dof_tuple_col_bounds.externalize(lhdf_buf);
483 
484  // Externalize the dof tuple domain offsets table.
485 
486  lhdf_buf++;
487  assertion(lhdf_buf < _hdf_bufs+_record_buffer_ub);
488 
489  _dof_tuple_domain_offsets.externalize(lhdf_buf);
490 
491  // Write all the records.
492 
493  write_selection();
494 
495  // Postconditions:
496 
497  // Exit
498 
499  return;
500 }
501 
502 
504 hid_t
507 {
508  hid_t result;
509 
510  // Preconditions:
511 
512  require(file().mode() == sheaf_file::READ_WRITE);
513 
514  // Body:
515 
516  // Create an fixed size dataspace.
517 
518  hsize_t linit_dims[DATASPACE_RANK];
519  linit_dims[0] = record_buffer_ub();
520 
521  _ext_dataspace_hdf_id = H5Screate_simple(DATASPACE_RANK, linit_dims, NULL);
522 
523  // Create the dataset with the internal data type.
524  // External data type will be set in record_set::open by querying the dataset.
525 
526  result = H5Dcreate1(file().hdf_id(),
527  name().c_str(),
530  H5P_DEFAULT);
531 
532  if(result < 0)
533  {
534  post_fatal_error_message("Unable to create dataset.");
535  }
536 
537  // Postconditions:
538 
539  ensure(result >= 0);
540 
541  // Exit
542 
543  return result;
544 }
545 
547 void
550 {
551  // Preconditions:
552 
553  require(file().is_open());
554 
555  // Body:
556 
557  // Data type is variable length char; see file_type_map::create_internal_types.
558 
562 
563  // Copy the type so we can handle all types the same in record_set::close().
564 
565  _int_data_type_hdf_id = H5Tcopy(type_map().converter(C_STRING)->internal_type());
566 
567  if(_int_data_type_hdf_id < 0)
568  {
569  post_fatal_error_message("Can't create internal data type");
570  }
571 
572  // Postconditions:
573 
574  ensure(int_data_type_hdf_id() >= 0);
575 
576  // Exit:
577 
578  return;
579 }
580 
582 void
583 sheaf::attributes_record_set::
584 read_selection()
585 {
586  // Preconditions:
587 
588  require(is_open());
589 
590  // Body:
591 
592  // Read all the records
593 
594  herr_t status = H5Dread(_hdf_id, _int_data_type_hdf_id, H5S_ALL,
595  H5S_ALL, H5P_DEFAULT, _hdf_bufs);
596  if(status < 0)
597  {
598  post_fatal_error_message("unable to read poset attributes dataset");
599  }
600 
601  // Now the records are active
602 
604 
605  // Postconditions:
606 
607  ensure(record_buffer_ct() == record_buffer_ub());
608 
609  // Exit
610 
611  return;
612 }
613 
614 
616 void
617 sheaf::attributes_record_set::
618 write_selection()
619 {
620  // Preconditions:
621 
622  require(is_open());
623 
624  // Body:
625 
626  // Read all the records
627 
628  herr_t status = H5Dwrite(_hdf_id, _ext_data_type_hdf_id,
630  H5P_DEFAULT, _hdf_bufs);
631  if(status < 0)
632  {
633  post_fatal_error_message("unable to write poset attributes dataset");
634  }
635 
636  // Now the records are active
637 
639 
640  // Postconditions:
641 
642  ensure(record_buffer_ct() == record_buffer_ub());
643 
644  // Exit
645 
646  return;
647 }
648 
649 
650 // PROTECTED MEMBER FUNCTIONS
651 
652 
654 void
657 {
658  // Preconditions:
659 
660  require(is_open());
661 
662  // Body:
663 
665 
666  // Postconditions:
667 
668  ensure(unexecutable("all attributes opened, read, and closed"));
669 
670  // Exit
671 
672  return;
673 }
674 
676 void
679 {
680  // Preconditions:
681 
682  require(is_open());
683 
684  // Body:
685 
687 
688  // Postconditions:
689 
690  ensure(unexecutable("all attributes created, written, and closed"));
691 
692  // Exit
693 
694  return;
695 }
696 
697 const char*
700 {
701  static const char result[] = "toc_bounds";
702  return result;
703 }
704 
705 const hsize_t sheaf::attributes_record_set::TOC_BOUNDS_EXTENT = 3; // mode, lb_id, ub_id
706 
708 void
711 {
712  // Preconditions:
713 
714  require(is_open());
715 
716  // Body:
717 
718 #ifdef DIAGNOSTIC_OUTPUT
719 
720  cout << "attributes_record_set::read_toc_bounds_attribute poset name: " << scaffold().structure().name() << endl;
721 #endif
722 
723  herr_t lstatus;
724 
725  // Open the toc_bounds attribute.
726 
727  hid_t ltoc_bounds_hdf_id = H5Aopen_name(_hdf_id, TOC_BOUNDS_ATTRIBUTE_NAME());
728  if(ltoc_bounds_hdf_id >= 0)
729  {
730  // Open succeeded; get the toc_bounds attribute data space and extent.
731 
732  hid_t ltoc_bounds_dataspace_hdf_id = H5Aget_space(ltoc_bounds_hdf_id);
733  if(ltoc_bounds_dataspace_hdf_id < 0)
734  {
735  post_fatal_error_message("Unable to get dof tuple toc_bounds attribute dataspace.");
736  }
737 
738  hsize_t ltoc_bounds_ct;
739  lstatus = H5Sget_simple_extent_dims(ltoc_bounds_dataspace_hdf_id, &ltoc_bounds_ct, NULL);
740  if(lstatus < 0)
741  {
742  post_fatal_error_message("Unable to get dof tuple toc_bounds attribute extent.");
743  }
744 
745  // Extent must be TOC_BOUNDS_EXTENT.
746 
747  assertion(ltoc_bounds_ct == TOC_BOUNDS_EXTENT);
748 
749  // Create some storage for the toc_bounds map that HDF can access.
750 
752 
753  // Read the toc_bounds attribute
754 
755  lstatus = H5Aread(ltoc_bounds_hdf_id,
756  type_map().converter(POD_INDEX_TYPE)->internal_type(),
757  ltoc_bounds);
758  if(lstatus < 0)
759  {
760  post_fatal_error_message("Unable to read dof tuple toc_bounds attribute.");
761  }
762 
763 #ifdef DIAGNOSTIC_OUTPUT
764  cout << "attribute_record_set::read_toc_bounds_attribute toc_bounds:"
765  << " " << ltoc_bounds[0]
766  << " " << ltoc_bounds[1]
767  << " " << ltoc_bounds[2]
768  << endl;
769 #endif
770 
771  // Transfer toc_bounds into the scaffold.
772 
774 
775  if(ltoc_bounds[0] == 1)
776  {
777  // Lower bound is member
778 
779  lmode = poset_bounds_descriptor::MEMBER_MEMBER;
780  }
781  else
782  {
783  // Lower bound is subposet
784 
785  lmode = poset_bounds_descriptor::SUBPOSET_MEMBER;
786  }
787 
788  poset_bounds_descriptor ldesc(lmode, ltoc_bounds[1], ltoc_bounds[2]);
789 
790  scaffold().update_toc_bounds(ldesc);
791 
792  // Close the attribute and dataspace.
793 
794  H5Sclose(ltoc_bounds_dataspace_hdf_id);
795  H5Aclose(ltoc_bounds_hdf_id);
796 
797  }
798  else
799  {
800  // Open failed.
801 
802  post_fatal_error_message("Unable to open toc_bounds attribute");
803  }
804 
805  // Postconditions:
806 
807  // Exit
808 
809 
810  return;
811 }
812 
814 void
817 {
818  // Preconditions:
819 
820  require(is_open());
821  require(scaffold().row_bounds().lb_is_singleton() ?
822  scaffold().member_id_space().contains_hub(scaffold().row_bounds().lb_id()) :
823  true);
824 
825 
826  // Body:
827 
828  // Transfer the toc lb into storage HDF can access.
829 
831 
832  pod_index_type lint_lb_id = scaffold().row_bounds().lb_id();
833 
834  if(scaffold().row_bounds().lb_is_singleton())
835  {
836  // lb_id is a member index
837 
838  ltoc_bounds[0] = 1;
839 
840  pod_index_type lext_lb_id = scaffold().member_id_space().pod(lint_lb_id);
841  if(is_valid(lext_lb_id))
842  {
843  ltoc_bounds[1] = lext_lb_id;
844  }
845  else
846  {
847  // Should never reach here.
848 
849  post_fatal_error_message("Invalid lower bound for table of contents.");
850  }
851  }
852  else
853  {
854  // lb_id is a subposet id.
855 
856  ltoc_bounds[0] = 0;
857  ltoc_bounds[1] = scaffold().subposet_id_space().pod(lint_lb_id);
858  }
859 
860  // Upper bound of toc may not have been written out yet and so may not
861  // have an entry in the index space. But the upper bound is top by definition
862  // and the external id of top is the same as the internal id.
865 
866  ltoc_bounds[2] = TOP_INDEX;
867 
868 #ifdef DIAGNOSTIC_OUTPUT
869  cout << "attribute_record_set::write_toc_bounds_attribute for poset: "
870  << scaffold().structure().name()
871  << " toc_bounds:"
872  << " " << ltoc_bounds[0]
873  << " " << ltoc_bounds[1]
874  << " " << ltoc_bounds[2]
875  << endl;
876 #endif
877 
878  herr_t lstatus;
879 
880  // Open the toc_bounds attribute.
881 
882  hid_t ltoc_bounds_hdf_id = H5Aopen_name(_hdf_id, TOC_BOUNDS_ATTRIBUTE_NAME());
883  if(ltoc_bounds_hdf_id < 0)
884  {
885  // toc_bounds attribute doesn't exist yet; create it.
886 
887  // Create the toc_bounds attribute data space.
888 
889  hid_t ltoc_bounds_dataspace_hdf_id = H5Screate(H5S_SIMPLE);
890  if(ltoc_bounds_dataspace_hdf_id < 0)
891  {
892  post_fatal_error_message("Unable to create dof tuple toc_bounds attribute dataspace.");
893  }
894 
895  // Set the extent of the dataspace.
896 
897  lstatus = H5Sset_extent_simple(ltoc_bounds_dataspace_hdf_id, 1, &TOC_BOUNDS_EXTENT, NULL);
898  if(lstatus < 0)
899  {
900  post_fatal_error_message("Unable to set dof tuple toc_bounds attribute extent.");
901  }
902 
903  // Create the toc_bounds attribute.
904 
905  // ltoc_bounds_hdf_id = H5Acreate(_hdf_id,
906  ltoc_bounds_hdf_id = H5Acreate1(_hdf_id,
908  type_map().converter(POD_INDEX_TYPE)->external_type(),
909  ltoc_bounds_dataspace_hdf_id,
910  H5P_DEFAULT);
911 
912  if(ltoc_bounds_hdf_id < 0)
913  {
914  post_fatal_error_message("Unable to create dof tuple toc_bounds attribute.");
915  }
916 
917  // Close the attribute dataspace.
918 
919  H5Sclose(ltoc_bounds_dataspace_hdf_id);
920  }
921 
922  // Write the toc_bounds attribute.
923 
924  lstatus = H5Awrite(ltoc_bounds_hdf_id,
925  type_map().converter(POD_INDEX_TYPE)->internal_type(),
926  ltoc_bounds);
927  if(lstatus < 0)
928  {
929  post_fatal_error_message("Unable to write dof tuple toc_bounds attribute.");
930  }
931 
932  // Close the attribute.
933 
934  H5Aclose(ltoc_bounds_hdf_id);
935 
936  // Postconditions:
937 
938  ensure(unexecutable("all attributes created, written, and closed"));
939 
940  // Exit
941 
942  return;
943 }
944 
945 
946 
947 
948 
An encapsulation of an HDF file containing sheaf data.
Definition: sheaf_file.h:49
int _ext_dataspace_rank
The rank of the dataspace for the record_set.
Definition: record_set.h:420
hsize_t * _ext_dataspace_dims
The current dimensions of the external dataspace.
Definition: record_set.h:425
virtual void write_toc_bounds_attribute()
Writes the table of contents lower bound attribute into the file.
void externalize(hdf_buf_type *xhdf_buffer)
Converts the record from internal to external form.
std::string data_set_alias(const std::string &xname) const
The data set alias for a poset with name xname.
Definition: record_set.cc:340
virtual ~attributes_record_set()
Destructor.
int record_buffer_ct() const
The number of active records in record buffer.
Definition: record_set.cc:635
virtual void create_int_data_type()
Creates a new HDF internal data type.
STL namespace.
int _record_buffer_ub
The maximum number of records the buffer can hold.
Definition: record_set.h:441
bool is_open() const
True if this record_set is open.
Definition: record_set.cc:567
virtual const std::string & suffix() const
The name suffix for this data set.
void update_toc_bounds(const poset_bounds_descriptor &xdesc)
Replaces toc_bounds() with the bounds specified in descriptor xdesc.
virtual bool invariant() const
Class invariant.
virtual attributes_record_set * clone() const
Virtual constructor; makes a new instance of the same type as this.
hid_t int_data_type_hdf_id()
The HDF internal data type id for this record set.
Definition: record_set.cc:989
virtual pod_type pod(pod_type xid) const
The pod index in this space equivalent to xid in the hub id space.
std::string alias() const
The standard alias for this data set.
Definition: record_set.cc:247
hid_t _hdf_id
The HDF id for this record set.
Definition: record_set.h:405
void internalize(hdf_buf_type *xhdf_buffer)
Converts the record from external to internal form.
attributes_record_set(const attributes_record_set &xother)
Copy constructor.
virtual bool invariant() const
Class invariant.
Definition: record_set.cc:71
Abstract base class with useful features for all objects.
Definition: any.h:39
std::string _alias
The standard alias for this record_set.
Definition: record_set.h:395
hid_t _ext_data_type_hdf_id
The HDF external data type id for this record set.
Definition: record_set.h:415
specification_mode
Enumeration for mode of specifying the lower and upper bounds.
virtual void read_dataset_attributes()
Reads the dataset attribute objects from the file.
hid_t _int_data_type_hdf_id
The HDF internal data type id for this record set.
Definition: record_set.h:452
bool is_open() const
True if this file is open.
Definition: sheaf_file.cc:306
std::string _name
The name of this record_set.
Definition: record_set.h:390
hid_t hdf_id()
The HDF id for this record set.
Definition: record_set.cc:929
int record_buffer_ub() const
The maximum number of records the buffer can hold.
Definition: record_set.cc:685
An abstract, indexed collection of records on secondary storage.
Definition: record_set.h:150
std::string data_set_name(const std::string &xname) const
The data set name for a poset with name xname.
Definition: record_set.cc:308
virtual void write_dataset_attributes()
Writes the dataset attribute objects into the file.
poset_bounds & row_bounds()
The bounds for the rows in this transaction (mutable version).
void internalize()
Internalize the record set from disk.
poset_scaffold & scaffold()
Scaffold for constructing poset associated with this record set (mutable version).
Definition: record_set.cc:416
virtual std::string name() const
The name of this poset.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
Definition: any.h:97
static const hsize_t TOC_BOUNDS_EXTENT
The extent of the table of contents lower bound attribute dataspace.
poset_state_handle & structure()
The handle for the poset being transferred. (Name chosen to void name conflict with class poset...
member_index_space_type & member_id_space()
External to internal member index space for structure() (mutable version).
std::string name() const
The name of this data set.
Definition: record_set.cc:224
A description of a (lower, upper) bounds pair for a poset. Specifies a portion of a poset for a bound...
A record set for storing various poset attributes.
void externalize()
Externalize the reccord set to disk.
subposet_index_space_type & subposet_id_space()
External to internal subposet index map for powerset() (mutable version).
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
bool invariant_check() const
True if invariant checking is enabled.
Definition: any.h:79
virtual void read_toc_bounds_attribute()
Reads the table of contents lower bound attribute into the file.
const sheaf_file & file() const
The file this record_set belongs to.
Definition: record_set.cc:213
pod_index_type pod_type
The "plain old data" storage type for this.
Definition: scoped_index.h:128
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
static const char * TOC_BOUNDS_ATTRIBUTE_NAME()
The name of the table of contents lower bound attribute.
poset_data_type_map & type_map()
Data type map for records in this record set (mutable version)
Definition: record_set.cc:432
A poset specific collection of data converters, various buffers and other data used while transferrin...
pod_index_type lb_id() const
The index of the lower bound member, if the lower bound contains a single member. ...
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
Definition: pod_types.cc:37
bool is_same_type(const any *other) const
True if other is the same type as this.
Definition: any.cc:79
hid_t _ext_dataspace_hdf_id
The HDF id for the external dataspace of this record set.
Definition: record_set.h:410
void enable_invariant_check() const
Enable invariant checking.
Definition: any.h:87
int _record_buffer_ct
The number of active records in record buffer.
Definition: record_set.h:436
hid_t _int_dataspace_hdf_id
The hdf5 id of the dataspace associated with the record buffer.
Definition: record_set.h:447
virtual hid_t create_dataset()
Creates the HDF dataset associated with this.