39#include "config_hdf5.h"
44#include <libdap/InternalErr.h>
53typedef struct s2_int16_t {
75 hid_t file_id = H5Fopen(dataset().c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
77 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the HDF5 file ID .");
82 dset_id = H5Dopen2(file_id,var_path.c_str(),H5P_DEFAULT);
84 dset_id = H5Dopen2(file_id,name().c_str(),H5P_DEFAULT);
88 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the datatype .");
91 hid_t dtypeid = H5Dget_type(dset_id);
95 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the datatype .");
98 hid_t memtype = H5Tget_native_type(dtypeid, H5T_DIR_ASCEND);
104 throw InternalErr(__FILE__, __LINE__,
"Cannot obtain the native datatype.");
108 if(
false == is_dap4()) {
109 if (1 == H5Tget_size(memtype) && H5T_SGN_2 == H5Tget_sign(memtype)) {
138 if (H5Tclose(memtype) < 0) {
139 throw InternalErr(__FILE__, __LINE__,
"Unable to close the datatype.");
142 if (H5Dclose(dset_id) < 0) {
143 throw InternalErr(__FILE__, __LINE__,
"Unable to close the dset.");
A class for HDF5 signed 16 bit integer type.
HDF5Int16(const std::string &n, const std::string &vpath, const std::string &d)
Constructor.
bool read() override
Reads HDF5 16-bit integer data into local buffer.
libdap::BaseType * ptr_duplicate() override
void get_data(hid_t dset, void *buf)
Data structure and retrieval processing header for the default option.
string get_dap_type(hid_t type, bool is_dap4)