41 #include "InternalErr.h"
78 if (H5Tclose(ty_id) < 0) {
79 throw InternalErr(__FILE__, __LINE__,
"Unable to close the datatype.");
81 if (H5Dclose(dset_id) < 0) {
82 throw InternalErr(__FILE__, __LINE__,
"Unable to close the dset.");
89 BaseType *q = get_parent();
91 throw InternalErr(__FILE__, __LINE__,
"null pointer");
95 int i = H5Tget_nmembers(ty_id);
97 throw InternalErr(__FILE__, __LINE__,
"H5Tget_nmembers() failed.");
103 hid_t s1_tid = H5Tcreate(H5T_COMPOUND,
sizeof(
s2_uint16_t));
107 throw InternalErr(__FILE__, __LINE__,
"cannot create a new datatype");
111 string myname = name();
115 <<
"=read() ty_id=" << ty_id
116 <<
" name=" << myname <<
" no of members =" << i << endl);
119 if (q->is_constructor_type()) {
122 DBG(cerr <<
"=read() my_name " << myname.
124 if (H5Tinsert(s1_tid, myname.c_str(), HOFFSET(
s2_uint16_t, a), H5T_NATIVE_UINT16) < 0) {
125 throw InternalErr(__FILE__, __LINE__,
"Unable to add datatype.");
129 DBG(cerr << k <<
"=read() parent_name=" << parent_name
132 stemp_tid = H5Tcreate(H5T_COMPOUND,
sizeof(
s2_uint16_t));
134 throw InternalErr(__FILE__, __LINE__,
"cannot create a new datatype");
136 if (H5Tinsert(stemp_tid, parent_name.c_str(), 0, s1_tid) < 0) {
137 throw InternalErr(__FILE__, __LINE__,
"Unable to add datatype.");
143 parent_name = q->name();
157 if (H5Dread(dset_id, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buf[0]) < 0) {
162 throw InternalErr(__FILE__, __LINE__,
"hdf5_dods server failed when getting int32 data for structure");
169 DBG(cerr <<
"index " << j << endl);
virtual BaseType * ptr_duplicate()
Clone this instance.
void set_tid(hid_t type)
remembers HDF5 datatype id.
This class converts HDF5 compound type into DAP structure for the default option. ...
string get_dap_type(hid_t type)
returns the string representation of HDF5 type.
int get_array_index()
returns the array index of this Structure if it's a part of array of structures.
void set_did(hid_t dset)
remembers HDF5 dataset id.
Data structure and retrieval processing header for the default option.
void get_data(hid_t dset, void *buf)
will get all data of a dset dataset and put it into buf.
struct s2_uint16_t s2_uint16_t
This class provides a way to map unsigned HDF5 16 bit integer to DAP UInt16 for the default option...
hid_t get_tid()
returns HDF5 datatype id.
hid_t get_did()
returns HDF5 dataset id.
HDF5UInt16(const string &n, const string &d)
Constructor.
int get_entire_array_size()
returns the entire array size of this Structure if it's a part of array of structures.
virtual bool read()
Reads HDF5 unsigned 16-bit integer data into local buffer.