33#include "config_hdf5.h"
35#include <libdap/InternalErr.h>
43HDF5CFInt16::HDF5CFInt16(
const string &n,
const string &d) :
Int16(n, d)
48HDF5CFInt16::HDF5CFInt16(
const string &n,
const string &d,
const string &d_f) :
Int16(n, d),filename(d_f)
52BaseType *HDF5CFInt16::ptr_duplicate()
57bool HDF5CFInt16::read()
59 BESDEBUG(
"h5",
"Coming to HDF5CFInt16 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.");
94 if(1 == H5Tget_size(memtype) && H5T_SGN_2 == H5Tget_sign(memtype)) {
105 if(H5Tclose(memtype) < 0) {
106 throw InternalErr(__FILE__, __LINE__,
"Unable to close the memory datatype.");
108 if(H5Tclose(dtypeid) < 0) {
109 throw InternalErr(__FILE__, __LINE__,
"Unable to close the datatype id.");
112 if (H5Dclose(dset_id) < 0) {
113 throw InternalErr(__FILE__, __LINE__,
"Unable to close the dset.");
This class provides a way to map HDF5 int16 to DAP int16 for the CF option.
void get_data(hid_t dset, void *buf)