33 #include "config_hdf5.h"
35 #include "InternalErr.h"
43 HDF5CFInt16::HDF5CFInt16(
const string &n,
const string &d) : Int16(n, d)
48 HDF5CFInt16::HDF5CFInt16(
const string &n,
const string &d,
const string &d_f) : Int16(n, d),filename(d_f)
52 HDF5CFInt16::~HDF5CFInt16()
55 BaseType *HDF5CFInt16::ptr_duplicate()
60 bool HDF5CFInt16::read()
62 BESDEBUG(
"h5",
"Coming to HDF5CFInt16 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.");
97 if(1 == H5Tget_size(memtype) && H5T_SGN_2 == H5Tget_sign(memtype)) {
108 if(H5Tclose(memtype) < 0) {
109 throw InternalErr(__FILE__, __LINE__,
"Unable to close the memory datatype.");
111 if(H5Tclose(dtypeid) < 0) {
112 throw InternalErr(__FILE__, __LINE__,
"Unable to close the datatype id.");
115 if (H5Dclose(dset_id) < 0) {
116 throw InternalErr(__FILE__, __LINE__,
"Unable to close the dset.");