38#include "config_hdf5.h"
44#include <libdap/InternalErr.h>
49HDF5Url::HDF5Url(
const string &n,
const string &vpath,
const string &d) : Url(n, d),var_path(vpath)
61 hid_t file_id = H5Fopen(dataset().c_str(),H5F_ACC_RDONLY,H5P_DEFAULT);
63 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the HDF5 file ID .");
68 dset_id = H5Dopen2(file_id,var_path.c_str(),H5P_DEFAULT);
70 dset_id = H5Dopen2(file_id,name().c_str(),H5P_DEFAULT);
74 throw InternalErr(__FILE__,__LINE__,
"Fail to obtain the datatype .");
79 if (H5Dread(dset_id, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT,
83 throw InternalErr(__FILE__, __LINE__,
"H5Dread() failed.");
86 hid_t did_r = H5RDEREFERENCE(dset_id, H5R_OBJECT, &rbuf);
91 throw InternalErr(__FILE__, __LINE__,
"H5RDEREFERENCE() failed.");
96 throw InternalErr(__FILE__, __LINE__,
"Unable to retrieve the name of the object.");
98 string reference = r_name;
This class generates DAP URL type for the default option.
bool read() override
Reads HDF5 reference data into local buffer as a string.
libdap::BaseType * ptr_duplicate() override
HDF5Url(const std::string &n, const std::string &vname, const std::string &d)
Constructor.
const int DODS_NAMELEN
Maximum length of variable or attribute name(default option only).