h5x::DataType data_type_to_h5(DataType dtype, bool for_memory) { if (for_memory) { return data_type_to_h5_memtype(dtype); } else { return data_type_to_h5_filetype(dtype); } }
void DataSet::write(DataType dtype, const NDSize &size, const void *data) { H5::DataType memType = data_type_to_h5_memtype(dtype); if (dtype == DataType::String) { StringReader reader(size, static_cast<const std::string *>(data)); h5dset.write(*reader, memType); } else { h5dset.write(data, memType); } }
void DataSet::write(DataType dtype, const void *data, const Selection &fileSel, const Selection &memSel) { H5::DataType memType = data_type_to_h5_memtype(dtype); if (dtype == DataType::String) { NDSize size = memSel.size(); StringReader reader(size, static_cast<const std::string *>(data)); h5dset.write(*reader, memType, memSel.h5space(), fileSel.h5space()); } else { h5dset.write(data, memType, memSel.h5space(), fileSel.h5space()); } }
void DataSet::read(DataType dtype, const NDSize &size, void *data) const { H5::DataType memType = data_type_to_h5_memtype(dtype); if (dtype == DataType::String) { StringWriter writer(size, static_cast<std::string *>(data)); h5dset.read(*writer, memType); writer.finish(); H5::DataSpace space = h5dset.getSpace(); H5::DataSet::vlenReclaim(*writer, memType, space); } else { h5dset.read(data, memType); } }
void DataSet::read(DataType dtype, void *data, const Selection &fileSel, const Selection &memSel) const { H5::DataType memType = data_type_to_h5_memtype(dtype); if (dtype == DataType::String) { NDSize size = memSel.size(); StringWriter writer(size, static_cast<std::string *>(data)); h5dset.read(*writer, memType, memSel.h5space(), fileSel.h5space()); writer.finish(); H5::DataSpace space = h5dset.getSpace(); H5::DataSet::vlenReclaim(*writer, memType, memSel.h5space()); } else { h5dset.read(data, memType, memSel.h5space(), fileSel.h5space()); } }