34#include <libdap/InternalErr.h>
42HDF5CFInt8::HDF5CFInt8(
const string &n,
const string &d) : Int8(n, d)
47HDF5CFInt8::HDF5CFInt8(
const string &n,
const string &d,
const string &d_f) : Int8(n, d),filename(d_f)
51BaseType *HDF5CFInt8::ptr_duplicate()
53 auto HDF5CFInt8_unique = make_unique<HDF5CFInt8>(*
this);
54 return HDF5CFInt8_unique.release();
57bool HDF5CFInt8::read()
59 BESDEBUG(
"h5",
"Coming to HDF5CFInt8 read "<<endl);
64 hid_t file_id = H5Fopen(filename.c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
66 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the HDF5 file ID .");
70 dset_id = H5Dopen2(file_id,dataset().c_str(),H5P_DEFAULT);
73 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the dataset .");
76 hid_t dtypeid = H5Dget_type(dset_id);
80 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the datatype .");
83 hid_t memtype = H5Tget_native_type(dtypeid, H5T_DIR_ASCEND);
88 throw InternalErr(__FILE__, __LINE__,
"Cannot obtain the native datatype.");
99 if(H5Tclose(memtype) < 0) {
100 throw InternalErr(__FILE__, __LINE__,
"Unable to close the memory datatype.");
102 if(H5Tclose(dtypeid) < 0) {
103 throw InternalErr(__FILE__, __LINE__,
"Unable to close the datatype id.");
106 if (H5Dclose(dset_id) < 0) {
107 throw InternalErr(__FILE__, __LINE__,
"Unable to close the dset.");
This class provides a way to map HDF5 int8 to DAP int16 for the CF option.
void get_data(hid_t dset, void *buf)