42#include "config_hdf5.h"
48#include <libdap/InternalErr.h>
58 : Str(n,d),var_path(vpath)
73 hid_t file_id = H5Fopen(dataset().c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
75 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the HDF5 file ID .");
80 dset_id = H5Dopen2(file_id,var_path.c_str(),H5P_DEFAULT);
82 dset_id = H5Dopen2(file_id,name().c_str(),H5P_DEFAULT);
86 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the datatype .");
89 hid_t dtypeid = H5Dget_type(dset_id);
93 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the datatype .");
96 size_t size = H5Tget_size(dtypeid);
102 throw InternalErr(__FILE__, __LINE__,
"cannot return the size of datatype");
106 if(H5Tis_variable_str(dtypeid) >0){
107 vector<string>finstrval;
109 read_vlen_string(dset_id,1,
nullptr,
nullptr,
nullptr,finstrval);
110 string strval = finstrval[0];
117 get_data(dset_id, (
void *) chr.data());
119 string str(chr.begin(),chr.end());
This class that translates HDF5 string into DAP string for the default option.
bool read() override
Reads HDF5 string data into local buffer
libdap::BaseType * ptr_duplicate() override
HDF5Str(const std::string &n, const std::string &vpath, const std::string &d)
Constructor.
void get_data(hid_t dset, void *buf)
Data structure and retrieval processing header for the default option.