SheafSystem
0.0.0.0
|
Function object to convert between internal and external data formats. More...
#include <data_converter.h>
Public Member Functions | |
virtual data_converter * | clone () const |
Virtual constructor; makes a new instance of the same type as this. More... | |
virtual | ~data_converter () |
Destructor. More... | |
virtual bool | invariant () const |
Class invariant. More... | |
virtual bool | is_ancestor_of (const any *other) const |
Conformance test; true if other conforms to this. More... | |
data_converter (hid_t xexternal_type, hid_t xinternal_type, int xinternal_index) | |
Creates a converter between the internal hdf type specified by xinternal_type and the external type specified by xexternal_type_name. If xcreate_ext_type, assumes that the external type does not already exist in the file and attempts to create it, otherwise attempts to open it. More... | |
bool | conversion_required () const |
True if internal and external types are not identical. More... | |
hid_t | external_type () const |
The external type identifier. More... | |
size_t | external_size () const |
The size in bytes of the external type. More... | |
void | externalize (const void *xint_buf, size_t xint_buf_ub, void *xext_buf, size_t xext_buf_ub, int xitem_ct) |
Copy xitem_ct data items from xint_buf to xext_buf and then convert them from internal to external format. More... | |
void | externalize (void *xext_buf, size_t xext_buf_ub, int xitem_ct) |
Convert xitem_ct data items in xext_buf from internal to external format. More... | |
void | externalize (const void *xint_buf, size_t xint_buf_ub) |
Copy one data item from xint_buf to result() and then convert it from internal to external format. More... | |
hid_t | internal_type () const |
The HDF type identifier for the internal type. More... | |
hid_t | internal_index () const |
The primitives poset member index for the internal type. More... | |
size_t | internal_size () const |
The size in bytes of the internal type. More... | |
size_t | internal_alignment () const |
The alignment of the internal type. More... | |
void | internalize (const void *xext_buf, size_t xext_buf_ub, void *xint_buf, size_t xint_buf_ub, int xitem_ct) |
Convert xitem_ct data items in xext_buf from external to internal format and place the result in xint_buf. More... | |
void | internalize (void *xbuf, size_t xbuf_ub, int xitem_ct) |
Convert xitem_ct data items in xbuf from external to internal format and leave the result in xbuf. More... | |
void | internalize (void *xbuf, size_t xbuf_ub) |
Convert one data item from xbuf from external to internal format and leave the result in result(). More... | |
bool | internal_size_greater () const |
True if the internal size is greater than the external size. More... | |
bool | external_size_greater () const |
True if the external size is greater than the internal size. More... | |
size_t | max_size () const |
The maximum of internal_size() and external_size(). More... | |
void * | result () const |
The result of the conversion. More... | |
size_t | result_size () const |
The allocated size of the result buffer. More... | |
bool | is_namespace_relative_member_index_type () const |
True if this is a converter for a naemspace_relative_member_index type. More... | |
bool | is_namespace_relative_subposet_index_type () const |
True if this is a converter for a namespace_relative_subposet_index type. More... | |
bool | is_string_type () const |
True if this is a converter for a string type. More... | |
size_t | string_length_total (const void *xbuf, int xitem_ct) const |
The total number of characters, including the terminators in all the strings in the array of strings xbuf. More... | |
Public Member Functions inherited from sheaf::any | |
bool | is_same_type (const any *other) const |
True if other is the same type as this. More... | |
virtual | ~any () |
Destructor. More... | |
bool | invariant_check () const |
True if invariant checking is enabled. More... | |
void | enable_invariant_check () const |
Enable invariant checking. More... | |
void | disable_invariant_check () const |
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing invariant checking during multi-phase initialization. More... | |
int | disable_invariance_check_request_depth () const |
Number of times disable_invariant_check has been called without matching call to enable_invariant_check. More... | |
Static Public Member Functions | |
static size_t | string_length (const char *xbuf) |
The number of characters in the string, including the terminator. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from sheaf::any | |
any () | |
default constructor More... | |
Function object to convert between internal and external data formats.
Definition at line 50 of file data_converter.h.
|
virtual |
Destructor.
Definition at line 64 of file data_converter.cc.
References invariant().
Referenced by clone().
sheaf::data_converter::data_converter | ( | hid_t | xexternal_type, |
hid_t | xinternal_type, | ||
int | xinternal_index | ||
) |
Creates a converter between the internal hdf type specified by xinternal_type and the external type specified by xexternal_type_name. If xcreate_ext_type, assumes that the external type does not already exist in the file and attempts to create it, otherwise attempts to open it.
Definition at line 169 of file data_converter.cc.
References sheaf::primitive_attributes::descriptor(), externalize(), invariant(), sheaf::is_primitive_index(), is_string_type(), and max_size().
|
virtual |
Virtual constructor; makes a new instance of the same type as this.
Reimplemented from sheaf::any.
Definition at line 40 of file data_converter.cc.
References sheaf::any::is_same_type(), result(), and ~data_converter().
|
inline |
True if internal and external types are not identical.
Definition at line 99 of file data_converter.h.
Referenced by externalize(), and internalize().
|
inline |
The size in bytes of the external type.
Definition at line 119 of file data_converter.h.
Referenced by externalize(), and internalize().
|
inline |
True if the external size is greater than the internal size.
Definition at line 229 of file data_converter.h.
Referenced by internalize().
|
inline |
The external type identifier.
Definition at line 109 of file data_converter.h.
Referenced by internalize(), and sheaf::record_set::write_attribute().
void sheaf::data_converter::externalize | ( | const void * | xint_buf, |
size_t | xint_buf_ub, | ||
void * | xext_buf, | ||
size_t | xext_buf_ub, | ||
int | xitem_ct | ||
) |
Copy xitem_ct data items from xint_buf to xext_buf and then convert them from internal to external format.
Definition at line 243 of file data_converter.cc.
References external_size(), internal_size(), internal_size_greater(), is_string_type(), max_size(), string_length(), and string_length_total().
Referenced by data_converter(), and externalize().
void sheaf::data_converter::externalize | ( | void * | xext_buf, |
size_t | xext_buf_ub, | ||
int | xitem_ct | ||
) |
Convert xitem_ct data items in xext_buf from internal to external format.
Definition at line 305 of file data_converter.cc.
References conversion_required(), externalize(), and max_size().
void sheaf::data_converter::externalize | ( | const void * | xint_buf, |
size_t | xint_buf_ub | ||
) |
Copy one data item from xint_buf to result() and then convert it from internal to external format.
Definition at line 336 of file data_converter.cc.
References conversion_required(), internal_size(), max_size(), result_size(), and string_length().
|
inline |
The alignment of the internal type.
Definition at line 186 of file data_converter.h.
Referenced by internalize().
|
inline |
The primitives poset member index for the internal type.
Definition at line 166 of file data_converter.h.
Referenced by internalize(), and sheaf::poset_general_record::transfer_poset_to_internal_buffer().
|
inline |
The size in bytes of the internal type.
Definition at line 176 of file data_converter.h.
Referenced by externalize(), internalize(), and sheaf::record_set::read_attribute().
|
inline |
True if the internal size is greater than the external size.
Definition at line 219 of file data_converter.h.
Referenced by externalize().
|
inline |
The HDF type identifier for the internal type.
Definition at line 156 of file data_converter.h.
Referenced by sheaf::dof_tuple_record_set::create_int_data_type(), internalize(), sheaf::record_set::read_attribute(), and sheaf::record_set::write_attribute().
void sheaf::data_converter::internalize | ( | const void * | xext_buf, |
size_t | xext_buf_ub, | ||
void * | xint_buf, | ||
size_t | xint_buf_ub, | ||
int | xitem_ct | ||
) |
Convert xitem_ct data items in xext_buf from external to internal format and place the result in xint_buf.
Definition at line 432 of file data_converter.cc.
References external_size(), external_size_greater(), internal_size(), is_string_type(), max_size(), and string_length().
Referenced by internalize(), and string_length_total().
void sheaf::data_converter::internalize | ( | void * | xbuf, |
size_t | xbuf_ub, | ||
int | xitem_ct | ||
) |
Convert xitem_ct data items in xbuf from external to internal format and leave the result in xbuf.
Definition at line 523 of file data_converter.cc.
References conversion_required(), internalize(), and max_size().
void sheaf::data_converter::internalize | ( | void * | xbuf, |
size_t | xbuf_ub | ||
) |
Convert one data item from xbuf from external to internal format and leave the result in result().
Definition at line 554 of file data_converter.cc.
References conversion_required(), external_size(), external_type(), internal_alignment(), internal_index(), internal_size(), internal_type(), invariant(), max_size(), and result_size().
|
virtual |
Class invariant.
Reimplemented from sheaf::any.
Definition at line 107 of file data_converter.cc.
References sheaf::any::disable_invariant_check(), sheaf::any::enable_invariant_check(), sheaf::any::invariant(), sheaf::any::invariant_check(), is_ancestor_of(), max_size(), result(), and result_size().
Referenced by data_converter(), internalize(), and ~data_converter().
|
virtual |
Conformance test; true if other conforms to this.
Reimplemented from sheaf::any.
Definition at line 144 of file data_converter.cc.
References result().
Referenced by invariant().
|
inline |
True if this is a converter for a naemspace_relative_member_index type.
Definition at line 269 of file data_converter.h.
Referenced by sheaf::dof_tuple_record_set::externalize_all_dofs(), and sheaf::dof_tuple_record_set::internalize_all_dofs().
|
inline |
True if this is a converter for a namespace_relative_subposet_index type.
Definition at line 279 of file data_converter.h.
Referenced by sheaf::dof_tuple_record_set::externalize_all_dofs(), and sheaf::dof_tuple_record_set::internalize_all_dofs().
|
inline |
True if this is a converter for a string type.
Definition at line 289 of file data_converter.h.
Referenced by data_converter(), externalize(), internalize(), and string_length_total().
|
inline |
The maximum of internal_size() and external_size().
Definition at line 239 of file data_converter.h.
Referenced by data_converter(), externalize(), internalize(), and invariant().
|
inline |
The result of the conversion.
Definition at line 249 of file data_converter.h.
Referenced by clone(), invariant(), is_ancestor_of(), string_length(), and string_length_total().
|
inline |
The allocated size of the result buffer.
Definition at line 259 of file data_converter.h.
Referenced by externalize(), internalize(), and invariant().
|
static |
The number of characters in the string, including the terminator.
Definition at line 373 of file data_converter.cc.
References result(), and string_length_total().
Referenced by externalize(), internalize(), and string_length_total().
size_t sheaf::data_converter::string_length_total | ( | const void * | xbuf, |
int | xitem_ct | ||
) | const |
The total number of characters, including the terminators in all the strings in the array of strings xbuf.
Definition at line 401 of file data_converter.cc.
References internalize(), is_string_type(), result(), and string_length().
Referenced by externalize(), and string_length().