20 #include "SheafSystem/map_record.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/error_message.h" 24 #include "SheafSystem/member_record_set.h" 25 #include "SheafSystem/interval_index_map_iterator.h" 110 require(
scaffold().structure().state_is_read_accessible());
114 #ifdef DIAGNOSTIC_OUTPUT 115 cout <<
"map_record::externalize:" << endl;
120 transfer_map_to_internal_buffer();
125 convert_internal_buffer_to_external_buffer(xmap);
129 transfer_external_buffer_to_HDF(xhdf_buffer);
141 transfer_map_to_internal_buffer()
145 require(
scaffold().structure().state_is_read_accessible());
166 convert_internal_buffer_to_external_buffer(
const interval_index_map& xmap)
174 initialize_external_buffer(xmap);
178 size_t lnext_field_offset = 0;
180 externalize_map_data(lnext_field_offset, xmap);
198 initialize_external_buffer(
const interval_index_map& xmap)
209 interval_index_map_iterator* litr =
210 dynamic_cast<interval_index_map_iterator*
>(xmap.iterator());
211 while(!litr->is_done())
214 litr->next_interval();
221 void* lbuf = lend_offset > 0 ?
new pod_index_type[lend_offset] : 0;
245 externalize_map_data(
size_t& xnext_field_offset,
const interval_index_map& xmap)
254 define_old_variable(
size_t old_xnext_field_offset = xnext_field_offset);
256 #ifdef DIAGNOSTIC_OUTPUT 258 <<
" file_id_map: " << endl;
259 xmap.print_map_rep(cout);
260 cout << xmap << endl;
263 interval_index_map_iterator* litr =
264 dynamic_cast<interval_index_map_iterator*
>(xmap.iterator(
false));
265 while(!litr->is_done())
267 int_buf()[xnext_field_offset++] = litr->domain_interval_begin();
268 int_buf()[xnext_field_offset++] = litr->domain_interval_end();
269 int_buf()[xnext_field_offset++] = litr->range_interval_begin();
270 int_buf()[xnext_field_offset++] = litr->range_interval_end();
271 litr->next_interval();
273 #ifdef DIAGNOSTIC_OUTPUT 275 cout << setw(12) << lbuf[0]
276 << setw(12) << lbuf[1]
277 << setw(12) << lbuf[2]
278 << setw(12) << lbuf[3]
287 ensure(xnext_field_offset ==
buf_ub());
297 transfer_external_buffer_to_HDF(hvl_t* xbuf)
311 ensure(xbuf->p ==
buf());
312 ensure(xbuf->len ==
buf_ub());
331 require(
scaffold().structure().state_is_read_write_accessible());
335 #ifdef DIAGNOSTIC_OUTPUT 336 cout <<
"map_record::internalize:" << endl;
341 transfer_HDF_to_external_buffer(xhdf_buffer);
346 convert_external_buffer_to_internal_buffer(xmap);
350 transfer_internal_buffer_to_map();
362 transfer_HDF_to_external_buffer(hvl_t* xbuf)
377 ensure(
buf() == xbuf->p);
378 ensure(
buf_ub() == xbuf->len);
390 convert_external_buffer_to_internal_buffer(interval_index_map& xmap)
396 size_t lnext_field_offset = 0;
400 internalize_map_data(lnext_field_offset, xmap);
418 internalize_map_data(
size_t& xnext_field_offset, interval_index_map& xmap)
427 define_old_variable(
size_t old_xnext_field_offset = xnext_field_offset);
430 while(xnext_field_offset <
buf_ub())
433 #ifdef DIAGNOSTIC_OUTPUT 434 cout << setw(12) << lbuf[0]
435 << setw(12) << lbuf[1]
436 << setw(12) << lbuf[2]
437 << setw(12) << lbuf[3]
441 xmap.insert_interval(lbuf[0], lbuf[1], lbuf[2], lbuf[3]);
442 xnext_field_offset += 4;
447 #ifdef DIAGNOSTIC_OUTPUT 449 <<
" file_id_map: " << endl;
450 xmap.print_map_rep(cout);
451 cout << xmap << endl;
456 ensure(xnext_field_offset ==
buf_ub());
466 transfer_internal_buffer_to_map()
470 require(
scaffold().structure().state_is_read_write_accessible());
557 bool result =
dynamic_cast<const map_record*
>(other) != 0;
virtual bool invariant() const
Class invariant.
poset_scaffold & scaffold()
The scaffold for the poset associated with this record (mutable version).
void * buf() const
The buffer.
The general variable length record wrapper/adapter for transferring data between the kernel and the i...
void externalize(hvl_t *xhdf_buffer, const interval_index_map &xmap)
Converts the record from internal to external form.
void put_delete_buffer(bool xval)
Sets delete_buffer to value xval.
virtual ~map_record()
Destructor.
void put_buf(const void *xbuf, size_t xub)
Sets the buffer to xbuf.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
Abstract base class with useful features for all objects.
A record_set containing records of type member_record.
void internalize(hvl_t *xhdf_buffer, interval_index_map &xmap)
Converts the record from external to internal form.
A record buffer for transferring file id map data for the member record data set between the kernel a...
size_t buf_ub() const
The size of the buffer, in bytes.
bool is_internal() const
True if the internal buffer has been initialized.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
void put_is_internal(bool xis_internal)
Sets is_internal to xis_internal.
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...
poset_state_handle & structure()
The handle for the poset being transferred. (Name chosen to void name conflict with class poset...
bool invariant_check() const
True if invariant checking is enabled.
map_record(member_record_set &xhost)
Creates an instance in record set xhost for reading or writing member data.
int_type pod_index_type
The plain old data index type.
virtual map_record * clone() const
Virtual constructor; makes a new instance of the same type as this.
virtual bool invariant() const
Class invariant.
bool is_external() const
True if the external buffer has been initialized.
bool is_same_type(const any *other) const
True if other is the same type as this.
void enable_invariant_check() const
Enable invariant checking.
void put_is_external(bool xis_external)
Sets is_external to xis_external.