OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
h5dds.cc
Go to the documentation of this file.
1 // This file is part of hdf5_handler a HDF5 file handler for the OPeNDAP
2 // data server.
3 
4 // Copyright (c) 2007-2013 The HDF Group, Inc. and OPeNDAP, Inc.
5 //
6 // This is free software; you can redistribute it and/or modify it under the
7 // terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 2.1 of the License, or (at your
9 // option) any later version.
10 //
11 // This software is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
21 // You can contact The HDF Group, Inc. at 1800 South Oak Street,
22 // Suite 203, Champaign, IL 61820
23 
37 
38 #include "config_hdf5.h"
39 
40 #include <InternalErr.h>
41 #include <debug.h>
42 #include <mime_util.h>
43 
44 #include "h5dds.h"
45 #include "HDF5Int32.h"
46 #include "HDF5UInt32.h"
47 #include "HDF5UInt16.h"
48 #include "HDF5Int16.h"
49 #include "HDF5Byte.h"
50 #include "HDF5Array.h"
51 #include "HDF5Str.h"
52 #include "HDF5Float32.h"
53 #include "HDF5Float64.h"
54 #include "HDF5Url.h"
55 #include "HDF5Structure.h"
56 #include "h5get.h"
57 
58 
60 static DS_t dt_inst;
61 
62 extern string get_hardlink(hid_t, const string &);
84 bool depth_first(hid_t pid, char *gname, DDS & dds, const char *fname)
85 {
86  DBG(cerr
87  << ">depth_first()"
88  << " pid: " << pid
89  << " gname: " << gname
90  << " fname: " << fname
91  << endl);
92 // cerr<<"coming to the depth_first "<<endl;
93 
94  // Iterate through the file to see the members of the group from the root.
95  H5G_info_t g_info;
96  hsize_t nelems = 0;
97  if(H5Gget_info(pid,&g_info) <0) {
98  string msg =
99  "h5_dds handler: counting hdf5 group elements error for ";
100  msg += gname;
101  throw InternalErr(__FILE__, __LINE__, msg);
102  }
103 
104  nelems = g_info.nlinks;
105 // cerr <<"nelems = " << nelems <<endl;
106 
107  ssize_t oname_size;
108  for (hsize_t i = 0; i < nelems; i++) {
109 
110  //char *oname = NULL;
111  vector <char>oname;
112 
113  try {
114 
115  // Query the length of object name.
116  oname_size =
117  H5Lget_name_by_idx(pid,".",H5_INDEX_NAME,H5_ITER_NATIVE,i,NULL,
118  (size_t)DODS_NAMELEN, H5P_DEFAULT);
119  if (oname_size <= 0) {
120  string msg = "h5_dds handler: Error getting the size of the hdf5 object from the group: ";
121  msg += gname;
122  throw InternalErr(__FILE__, __LINE__, msg);
123  }
124 
125  // Obtain the name of the object
126  // TODO vector<char>
127  //oname = new char[(size_t) oname_size + 1];
128  oname.resize((size_t) oname_size + 1);
129 
130  //if (H5Lget_name_by_idx(pid,".",H5_INDEX_NAME,H5_ITER_NATIVE,i,oname,
131  if (H5Lget_name_by_idx(pid,".",H5_INDEX_NAME,H5_ITER_NATIVE,i,&oname[0],
132  (size_t)(oname_size+1), H5P_DEFAULT) < 0){
133  string msg =
134  "h5_dds handler: Error getting the hdf5 object name from the group: ";
135  msg += gname;
136  throw InternalErr(__FILE__, __LINE__, msg);
137  }
138 
139  // Check if it is the hard link or the soft link
140  H5L_info_t linfo;
141  //if (H5Lget_info(pid,oname,&linfo,H5P_DEFAULT)<0) {
142  if (H5Lget_info(pid,&oname[0],&linfo,H5P_DEFAULT)<0) {
143  string msg = "hdf5 link name error from: ";
144  msg += gname;
145  throw InternalErr(__FILE__, __LINE__, msg);
146  }
147 
148  // We ignore soft link and hard link in this release
149  if(linfo.type == H5L_TYPE_SOFT || linfo.type == H5L_TYPE_EXTERNAL)
150  continue;
151 
152  // Obtain the object type, such as group or dataset.
153  H5O_info_t oinfo;
154 
155  if (H5Oget_info_by_idx(pid, ".", H5_INDEX_NAME, H5_ITER_NATIVE,
156  i, &oinfo, H5P_DEFAULT)<0) {
157  string msg = "h5_dds handler: Error obtaining the info for the object";
158  //msg += oname;
159  msg += string(oname.begin(),oname.end());
160  throw InternalErr(__FILE__, __LINE__, msg);
161  }
162 
163  H5O_type_t obj_type = oinfo.type;
164 
165  switch (obj_type) {
166 
167  case H5O_TYPE_GROUP: {
168 
169  // Obtain the full path name
170  string full_path_name =
171  string(gname) + string(oname.begin(),oname.end()-1) + "/";
172  //string(gname) + string(oname) + "/";
173 
174  DBG(cerr << "=depth_first():H5G_GROUP " << full_path_name
175  << endl);
176 
177  // Get the C char* of the object name
178  // FIXME t_fpn leaked
179 
180  vector <char>t_fpn;
181  t_fpn.resize(full_path_name.length()+1);
182  copy(full_path_name.begin(),full_path_name.end(),t_fpn.begin());
183 
184 // char *t_fpn = new char[full_path_name.length() + 1];
185  // (void)full_path_name.copy(t_fpn, full_path_name.length());
186  t_fpn[full_path_name.length()] = '\0';
187 
188  hid_t cgroup = H5Gopen(pid, &t_fpn[0],H5P_DEFAULT);
189  if (cgroup < 0){
190  throw InternalErr(__FILE__, __LINE__, "h5_dds handler: H5Gopen() failed.");
191  }
192 
193  // Check the hard link loop and break the loop if it exists.
194  // Note the function get_hardlink is defined in h5das.cc
195  //string oid = get_hardlink(pid, oname);
196  string oid = get_hardlink(pid, &oname[0]);
197  if (oid == "") {
198  depth_first(cgroup, &t_fpn[0], dds, fname);
199  }
200 
201  if (H5Gclose(cgroup) < 0){
202  throw InternalErr(__FILE__, __LINE__, "Could not close the group.");
203  }
204  // if (t_fpn) {delete[]t_fpn; t_fpn = NULL;}
205  break;
206  }
207 
208  case H5O_TYPE_DATASET:{
209 
210  // Obtain the absolute path of the HDF5 dataset
211  //string full_path_name = string(gname) + string(oname);
212  string full_path_name = string(gname) + string(oname.begin(),oname.end()-1);
213 //cerr<<"dataset full_path "<<full_path_name <<endl;
214 //cerr<<"dataset fill_path size is "<<full_path_name.size() <<endl;
215 
216  // Obtain the hdf5 dataset handle stored in the structure dt_inst.
217  // All the metadata information in the handler is stored in dt_inst.
218  get_dataset(pid, full_path_name, &dt_inst);
219 
220  // Put the hdf5 dataset structure into DODS dds.
221  read_objects(dds, full_path_name, fname);
222  break;
223  }
224 
225  case H5O_TYPE_NAMED_DATATYPE:
226  // ignore the named datatype
227  break;
228  default:
229  break;
230  }
231  } // try
232  catch(...) {
233 
234  //if (oname) {delete[]oname; oname = NULL;}
235  throw;
236 
237  } // catch
238  //if (oname) {delete[]oname; oname = NULL;}
239  } // for i is 0 ... nelems
240 
241  DBG(cerr << "<depth_first() " << endl);
242  return true;
243 }
244 
245 
259 static BaseType *Get_bt(const string &vname,
260  const string &dataset,
261  hid_t datatype)
262 {
263  BaseType *btp = NULL;
264 
265  try {
266 
267  DBG(cerr << ">Get_bt varname=" << vname << " datatype=" << datatype
268  << endl);
269 
270  size_t size = 0;
271  int sign = -2;
272  switch (H5Tget_class(datatype)) {
273 
274  case H5T_INTEGER:
275  size = H5Tget_size(datatype);
276  sign = H5Tget_sign(datatype);
277  DBG(cerr << "=Get_bt() H5T_INTEGER size = " << size << " sign = "
278  << sign << endl);
279 
280  if (sign == H5T_SGN_ERROR) {
281  throw InternalErr(__FILE__, __LINE__, "cannot retrieve the sign type of the integer");
282  }
283  if (size == 0) {
284  throw InternalErr(__FILE__, __LINE__, "cannot return the size of the datatype");
285  }
286  else if (size == 1) { // Either signed char or unsigned char
287  // DAP2 doesn't support signed char, it maps to DAP int16.
288  if (sign == H5T_SGN_2) // signed char to DAP int16
289  btp = new HDF5Int16(vname, dataset);
290  else
291  btp = new HDF5Byte(vname, dataset);
292  }
293  else if (size == 2) {
294  if (sign == H5T_SGN_2)
295  btp = new HDF5Int16(vname, dataset);
296  else
297  btp = new HDF5UInt16(vname, dataset);
298  }
299  else if (size == 4) {
300  if (sign == H5T_SGN_2)
301  btp = new HDF5Int32(vname, dataset);
302  else
303  btp = new HDF5UInt32(vname, dataset);
304  }
305  else if (size == 8) {
306  throw
307  InternalErr(__FILE__, __LINE__,
308  string("Unsupported HDF5 64-bit Integer type:")
309  + vname);
310  }
311  break;
312 
313  case H5T_FLOAT:
314  size = H5Tget_size(datatype);
315  DBG(cerr << "=Get_bt() H5T_FLOAT size = " << size << endl);
316 
317  if (size == 0) {
318  throw InternalErr(__FILE__, __LINE__, "cannot return the size of the datatype");
319  }
320  else if (size == 4) {
321  btp = new HDF5Float32(vname, dataset);
322  }
323  else if (size == 8) {
324  btp = new HDF5Float64(vname, dataset);
325  }
326  break;
327 
328  case H5T_STRING:
329  btp = new HDF5Str(vname, dataset);
330  break;
331 
332  // The array datatype is rarely,rarely used. So this
333  // part of code is not reviewed.
334  case H5T_ARRAY: {
335  BaseType *ar_bt = 0;
336  try {
337  DBG(cerr <<
338  "=Get_bt() H5T_ARRAY datatype = " << datatype
339  << endl);
340 
341  // Get the base datatype of the array
342  hid_t dtype_base = H5Tget_super(datatype);
343  ar_bt = Get_bt(vname, dataset, dtype_base);
344  btp = new HDF5Array(vname, dataset, ar_bt);
345  delete ar_bt; ar_bt = 0;
346 
347  // Set the size of the array.
348  int ndim = H5Tget_array_ndims(datatype);
349  size = H5Tget_size(datatype);
350  int nelement = 1;
351 
352  if (dtype_base < 0) {
353  throw InternalErr(__FILE__, __LINE__, "cannot return the base datatype");
354  }
355  if (ndim < 0) {
356  throw InternalErr(__FILE__, __LINE__, "cannot return the rank of the array datatype");
357  }
358  if (size == 0) {
359  throw InternalErr(__FILE__, __LINE__, "cannot return the size of the datatype");
360  }
361  DBG(cerr
362  << "=Get_bt()" << " Dim = " << ndim
363  << " Size = " << size
364  << endl);
365 
366  hsize_t size2[DODS_MAX_RANK];
367  if(H5Tget_array_dims(datatype, size2) < 0){
368  throw
369  InternalErr(__FILE__, __LINE__,
370  string("Could not get array dims for: ")
371  + vname);
372  }
373 
374 
375  HDF5Array &h5_ar = static_cast < HDF5Array & >(*btp);
376  for (int dim_index = 0; dim_index < ndim; dim_index++) {
377  h5_ar.append_dim(size2[dim_index]);
378  DBG(cerr << "=Get_bt() " << size2[dim_index] << endl);
379  nelement = nelement * size2[dim_index];
380  }
381 
382  h5_ar.set_did(dt_inst.dset);
383  // Assign the array datatype id.
384  h5_ar.set_tid(datatype);
385  h5_ar.set_memneed(size);
386  h5_ar.set_numdim(ndim);
387  h5_ar.set_numelm(nelement);
388  h5_ar.set_length(nelement);
389  h5_ar.d_type = H5Tget_class(dtype_base);
390  if (h5_ar.d_type == H5T_NO_CLASS){
391  throw InternalErr(__FILE__, __LINE__, "cannot return the datatype class identifier");
392  }
393  }
394  catch (...) {
395  if( ar_bt ) delete ar_bt;
396  if( btp ) delete btp;
397  throw;
398  }
399  break;
400  }
401 
402  // Reference map to DAP URL, check the technical note.
403  case H5T_REFERENCE:
404  btp = new HDF5Url(vname, dataset);
405  break;
406 
407  default:
408  throw InternalErr(__FILE__, __LINE__,
409  string("Unsupported HDF5 type: ") + vname);
410  }
411  }
412  catch (...) {
413  if( btp ) delete btp;
414  throw;
415  }
416 
417  if (!btp)
418  throw InternalErr(__FILE__, __LINE__,
419  string("Could not make a DAP variable for: ")
420  + vname);
421 
422  // Dynamic cast the HDF5 datatype to DAP2 type, also save the HDF5 datatype
423  switch (btp->type()) {
424 
425  case dods_byte_c: {
426  // TODO In this/these case(s) you know the type is a dods_byte so you can
427  // safely use static_cast<>() instead of the more expensive static_cast
428  // operator. Not a huge deal, but static_cast is faster.
429  HDF5Byte &v = static_cast < HDF5Byte & >(*btp);
430  v.set_did(dt_inst.dset);
431  v.set_tid(dt_inst.type);
432  break;
433  }
434 
435  case dods_int16_c: {
436  HDF5Int16 &v = static_cast < HDF5Int16 & >(*btp);
437  v.set_did(dt_inst.dset);
438  v.set_tid(dt_inst.type);
439  break;
440  }
441  case dods_uint16_c: {
442  HDF5UInt16 &v = static_cast < HDF5UInt16 & >(*btp);
443  v.set_did(dt_inst.dset);
444  v.set_tid(dt_inst.type);
445  break;
446  }
447  case dods_int32_c: {
448  HDF5Int32 &v = static_cast < HDF5Int32 & >(*btp);
449  v.set_did(dt_inst.dset);
450  v.set_tid(dt_inst.type);
451  break;
452  }
453  case dods_uint32_c: {
454  HDF5UInt32 &v = static_cast < HDF5UInt32 & >(*btp);
455  v.set_did(dt_inst.dset);
456  v.set_tid(dt_inst.type);
457  break;
458  }
459  case dods_float32_c: {
460  HDF5Float32 &v = static_cast < HDF5Float32 & >(*btp);
461  v.set_did(dt_inst.dset);
462  v.set_tid(dt_inst.type);
463  break;
464  }
465  case dods_float64_c: {
466  HDF5Float64 &v = static_cast < HDF5Float64 & >(*btp);
467  v.set_did(dt_inst.dset);
468  v.set_tid(dt_inst.type);
469  break;
470  }
471  case dods_str_c: {
472  HDF5Str &v = static_cast < HDF5Str & >(*btp);
473  v.set_did(dt_inst.dset);
474  v.set_tid(dt_inst.type);
475  break;
476  }
477  case dods_array_c:
478  break;
479 
480  case dods_url_c: {
481  HDF5Url &v = static_cast < HDF5Url & >(*btp);
482  v.set_did(dt_inst.dset);
483  v.set_tid(dt_inst.type);
484  break;
485  }
486  default:
487  delete btp;
488  throw InternalErr(__FILE__, __LINE__,
489  string("error counting hdf5 group elements for ")
490  + vname);
491  }
492  DBG(cerr << "<Get_bt()" << endl);
493  return btp;
494 }
495 
496 
512 static Structure *Get_structure(const string &varname,
513  const string &dataset,
514  hid_t datatype)
515 {
516  HDF5Structure *structure_ptr = NULL;
517 
518  DBG(cerr << ">Get_structure()" << datatype << endl);
519 
520  if (H5Tget_class(datatype) != H5T_COMPOUND)
521  throw InternalErr(__FILE__, __LINE__,
522  string("Compound-to-structure mapping error for ")
523  + varname);
524 
525  try {
526  structure_ptr = new HDF5Structure(varname, dataset);
527  structure_ptr->set_did(dt_inst.dset);
528  structure_ptr->set_tid(dt_inst.type);
529 
530  // Retrieve member types
531  int nmembs = H5Tget_nmembers(datatype);
532  DBG(cerr << "=Get_structure() has " << nmembs << endl);
533  if (nmembs < 0){
534  throw InternalErr(__FILE__, __LINE__, "cannot retrieve the number of elements");
535  }
536  for (int i = 0; i < nmembs; i++) {
537  char *memb_name = H5Tget_member_name(datatype, i);
538  H5T_class_t memb_cls = H5Tget_member_class(datatype, i);
539  hid_t memb_type = H5Tget_member_type(datatype, i);
540  if (memb_name == NULL){
541  throw InternalErr(__FILE__, __LINE__, "cannot retrieve the name of the member");
542  }
543  if ((memb_cls < 0) | (memb_type < 0)) {
544  // structure_ptr is deleted in the catch ... block
545  // below. So if this exception is thrown, it will
546  // get caught below and the ptr deleted.
547  // pwest Mar 18, 2009
548  //delete structure_ptr;
549  throw InternalErr(__FILE__, __LINE__,
550  string("Type mapping error for ")
551  + string(memb_name) );
552  }
553 
554  // ~Structure() will delete these if they are added.
555  if (memb_cls == H5T_COMPOUND) {
556  Structure *s = Get_structure(memb_name, dataset, memb_type);
557  structure_ptr->add_var(s);
558  delete s; s = 0;
559  }
560  else {
561  BaseType *bt = Get_bt(memb_name, dataset, memb_type);
562  structure_ptr->add_var(bt);
563  delete bt; bt = 0;
564  }
565  // Caller needs to free the memory allocated by the library for memb_name.
566  free(memb_name);
567  }
568  }
569  catch (...) {
570  // if memory allocation exception thrown it will be caught
571  // here, so should check if structure ptr exists before
572  // deleting it. pwest Mar 18, 2009
573  if( structure_ptr ) delete structure_ptr;
574  throw;
575  }
576 
577  DBG(cerr << "<Get_structure()" << endl);
578 
579  return structure_ptr;
580 }
581 
582 
604 void
605 read_objects_base_type(DDS & dds_table, const string & varname,
606  const string & filename)
607 {
608  // Obtain the DDS dataset name.
609  dds_table.set_dataset_name(name_path(filename));
610 
611  // The following code lines are not used and it causes memory leaking. Comment out.
612  // KY 2014-03-19
613 #if 0
614  //declare an array to store HDF5 dimensions
615  hid_t *dimids = NULL;
616  try {
617  dimids = new hid_t[dt_inst.ndims];
618  }
619  catch (...) {
620  if(dimids) {
621  delete [] dimids;
622  dimids=0;
623  }
624  throw;
625  }
626 #endif
627 
628  // Get a base type. It should be int, float, double, etc. -- atomic
629  // datatype.
630  BaseType *bt = Get_bt(varname, filename, dt_inst.type);
631 
632  if (!bt) {
633  // NB: We're throwing InternalErr even though it's possible that
634  // someone might ask for an HDF5 varaible which this server cannot
635  // handle.
636  throw
637  InternalErr(__FILE__, __LINE__,
638  "Unable to convert hdf5 datatype to dods basetype");
639  }
640 
641  // First deal with scalar data.
642  if (dt_inst.ndims == 0) {
643  dds_table.add_var(bt);
644  delete bt; bt = 0;
645  }
646  else {
647  // Next, deal with Array and Grid data. This 'else clause' runs to
648  // the end of the method. jhrg
649 
650 //cerr<<"varname "<<varname <<endl;
651 //cerr<<"varname size is "<<varname.size() <<endl;
652  HDF5Array *ar = new HDF5Array(varname, filename, bt);
653  delete bt; bt = 0;
654  ar->set_did(dt_inst.dset);
655  ar->set_tid(dt_inst.type);
656  ar->set_memneed(dt_inst.need);
657  ar->set_numdim(dt_inst.ndims);
658  ar->set_numelm((int) (dt_inst.nelmts));
659  for (int dim_index = 0; dim_index < dt_inst.ndims; dim_index++)
660  ar->append_dim(dt_inst.size[dim_index]);
661  dds_table.add_var(ar);
662  delete ar; ar = 0;
663  }
664 
665  DBG(cerr << "<read_objects_base_type(dds)" << endl);
666 }
667 
679 void
680 read_objects_structure(DDS & dds_table, const string & varname,
681  const string & filename)
682 {
683  dds_table.set_dataset_name(name_path(filename));
684 
685  Structure *structure = Get_structure(varname, filename, dt_inst.type);
686  try {
687  // Assume Get_structure() uses exceptions to signal an error. jhrg
688  DBG(cerr << "=read_objects_structure(): Dimension is "
689  << dt_inst.ndims << endl);
690 
691  if (dt_inst.ndims != 0) { // Array of Structure
692  int dim_index;
693  DBG(cerr << "=read_objects_structure(): array of size " <<
694  dt_inst.nelmts << endl);
695  DBG(cerr << "=read_objects_structure(): memory needed = " <<
696  dt_inst.need << endl);
697  HDF5Array *ar = new HDF5Array(varname, filename, structure);
698  delete structure; structure = 0;
699  try {
700  ar->set_did(dt_inst.dset);
701  ar->set_tid(dt_inst.type);
702  ar->set_memneed(dt_inst.need);
703  ar->set_numdim(dt_inst.ndims);
704  ar->set_numelm((int) (dt_inst.nelmts));
705  ar->set_length((int) (dt_inst.nelmts));
706 
707  for (dim_index = 0; dim_index < dt_inst.ndims; dim_index++) {
708  ar->append_dim(dt_inst.size[dim_index]);
709  DBG(cerr << "=read_objects_structure(): append_dim = " <<
710  dt_inst.size[dim_index] << endl);
711  }
712 
713  dds_table.add_var(ar);
714  delete ar; ar = 0;
715  } // try Array *ar
716  catch (...) {
717  delete ar;
718  throw;
719  }
720  }
721  else {// A scalar structure
722 
723  dds_table.add_var(structure);
724  delete structure; structure = 0;
725  }
726 
727  } // try Structure *structure = Get_structure(...)
728  catch (...) {
729  delete structure;
730  throw;
731  }
732 }
733 
745 void
746 read_objects(DDS & dds_table, const string &varname, const string &filename)
747 {
748 
749  switch (H5Tget_class(dt_inst.type)) {
750 
751  // HDF5 compound maps to DAP structure.
752  case H5T_COMPOUND:
753  read_objects_structure(dds_table, varname, filename);
754  break;
755 
756  default:
757  read_objects_base_type(dds_table, varname, filename);
758  break;
759  }
760 }
761 
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5Int32.cc:183
This class generates DAP URL type for the default option.
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5Url.cc:94
void free(void *)
A structure for DDS generation.
Definition: hdf5_handler.h:68
A class for HDF5 signed 16 bit integer type.
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5UInt16.cc:181
void set_memneed(size_t need)
remembers memory size needed.
Definition: HDF5Array.cc:694
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5Float32.cc:173
hid_t dset
HDF5 data set id.
Definition: hdf5_handler.h:72
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5UInt32.cc:173
bool depth_first(hid_t pid, char *gname, DDS &dds, const char *fname)
will fill DDS table.
Definition: h5dds.cc:84
This class converts HDF5 compound type into DAP structure for the default option. ...
This class provides a way to map HDF5 32 bit integer to DAP Int32 for the default option...
void get_dataset(hid_t pid, const string &dname, DS_t *dt_inst_ptr)
obtain data information in a dataset datatype, dataspace(dimension sizes) and number of dimensions an...
Definition: h5get.cc:374
H5T_class_t d_type
HDF5 data type class.
Definition: HDF5Array.h:79
#define DODS_MAX_RANK
Maximum number of dimensions in an array(default option only).
Definition: hdf5_handler.h:41
void set_numelm(int nelms)
remembers number of elements in this array.
Definition: HDF5Array.cc:702
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5UInt16.cc:176
Data structure and retrieval processing header for the default option.
void read_objects(DDS &dds_table, const string &varname, const string &filename)
fills in information of a dataset (name, data type, data space) into one DDS table.
Definition: h5dds.cc:746
string get_hardlink(hid_t, const string &)
#define DODS_NAMELEN
Maximum length of variable or attribute name(default option only).
Definition: hdf5_handler.h:43
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5Float32.cc:168
void read_objects_base_type(DDS &dds_table, const string &varname, const string &filename)
fills in information of a dataset (name, data type, data space) into one DDS table.
Definition: h5dds.cc:605
void read_objects_structure(DDS &dds_table, const string &varname, const string &filename)
fills in information of a structure dataset (name, data type, data space) into a DDS table...
Definition: h5dds.cc:680
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5Byte.cc:174
void set_numdim(int ndims)
remembers number of dimensions of this array.
Definition: HDF5Array.cc:698
int size[DODS_MAX_RANK]
Size of each dimension.
Definition: hdf5_handler.h:80
A class for mapping HDF5 64-bit float to DAP for the default option.
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5Str.cc:192
#define NULL
Definition: wcsUtil.h:65
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5Byte.cc:179
This class that translates HDF5 string into DAP string for the default option.
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5Str.cc:187
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5Array.cc:690
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5Int32.cc:178
This class provides a way to map unsigned HDF5 16 bit integer to DAP UInt16 for the default option...
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5Url.cc:89
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5Int16.cc:194
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5Float64.cc:167
void set_did(hid_t dset)
remembers HDF5 dataset id.
Definition: HDF5Array.cc:686
This class provides a way to map HDF5 byte to DAP Byte for the default option.
void set_did(hid_t dset)
remembers HDF5 datatype id.
This class provides a way to map unsigned HDF5 32 bit integer to DAP UInt32.
hid_t type
HDF5 data type id.
Definition: hdf5_handler.h:74
hsize_t nelmts
Number of elements.
Definition: hdf5_handler.h:82
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5UInt32.cc:178
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5Int16.cc:199
A class for handling all types of array in HDF5 for the default option.
size_t need
Space needed.
Definition: hdf5_handler.h:84
Helper functions to generate DDS/DAS/DODS for the default option.
int ndims
Number of dimensions.
Definition: hdf5_handler.h:78
void set_tid(hid_t type)
remembers HDF5 datatype id.
Definition: HDF5Float64.cc:172
A class for mapping HDF5 32-bit float to DAP for the default option.
void set_tid(hid_t type)
remembers HDF5 datatype id.