DASH  0.3.0
dash::io::hdf5::type_converter Class Reference

Converter function to convert non-POT types and especially structs to HDF5 types. More...

#include <IOManip.h>

Public Member Functions

 type_converter (type_converter_fun_type fun=get_h5_datatype< UNSPECIFIED_TYPE >)
 
 operator type_converter_fun_type ()
 

Detailed Description

Converter function to convert non-POT types and especially structs to HDF5 types.

Example:

// Struct that is stored in DASH array
struct value_t { double a; int b; };
// Conversion function
auto converter = [](){
hid_t h5tid = H5Tcreate (H5T_COMPOUND, sizeof(value_t));
H5Tinsert(h5tid, "a_name", HOFFSET(value_t, a), H5T_NATIVE_DOUBLE);
H5Tinsert(h5tid, "b_name", HOFFSET(value_t, b), H5T_NATIVE_INT);
return h5tid;
};
dash::Array<value_t> array_a(1000);
// [...]
// store data
OutputStream os(_filename);
os << dio::dataset("array_a")
<< dio::type_converter(converter)
<< array_a;
// restore data
dash::Array<value_t> array_b(1000);
InputStream is(_filename);
is >> dio::dataset("array_a")
>> dio::type_converter(converter)
>> array_b;

Definition at line 113 of file IOManip.h.


The documentation for this class was generated from the following file: