33#include "config_hdf5.h"
35#include <libdap/InternalErr.h>
43HDF5CFInt8::HDF5CFInt8(
const string &n,
const string &d) : Int8(n, d)
48HDF5CFInt8::HDF5CFInt8(
const string &n,
const string &d,
const string &d_f) : Int8(n, d),filename(d_f)
52HDF5CFInt8::~HDF5CFInt8()
55BaseType *HDF5CFInt8::ptr_duplicate()
60bool HDF5CFInt8::read()
62 BESDEBUG(
"h5",
"Coming to HDF5CFInt8 read "<<endl);
67 hid_t file_id = H5Fopen(filename.c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
69 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the HDF5 file ID .");
73 dset_id = H5Dopen2(file_id,dataset().c_str(),H5P_DEFAULT);
76 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the dataset .");
79 hid_t dtypeid = H5Dget_type(dset_id);
83 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the datatype .");
86 hid_t memtype = H5Tget_native_type(dtypeid, H5T_DIR_ASCEND);
91 throw InternalErr(__FILE__, __LINE__,
"Cannot obtain the native datatype.");
102 if(H5Tclose(memtype) < 0) {
103 throw InternalErr(__FILE__, __LINE__,
"Unable to close the memory datatype.");
105 if(H5Tclose(dtypeid) < 0) {
106 throw InternalErr(__FILE__, __LINE__,
"Unable to close the datatype id.");
109 if (H5Dclose(dset_id) < 0) {
110 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)