Getting constituents of a datatyoe

All,

Given the dataset I would like to know what are the individual datatypes ( I do not need hid_t for the datatype . I need actual datatype list) that make up the dataset . Is there any API which can do this ?

Regards

Ramakrishnan

A Tuesday 29 April 2008, Ramakrishnan Iyer escrigué:

All,

Given the dataset I would like to know what are the individual
datatypes ( I do not need hid_t for the datatype . I need actual
datatype list) that make up the dataset . Is there any API which can
do this ?

I assume that you have complex datatypes. I don't know if there is a
more direct way, but what I normally do is, given the type_id, use the
H5Tget_class & H5Tget_size routines:

  // Get the HDF5 class
  class_id = H5Tget_class(type_id);
  // Get the itemsize
  itemsize = H5Tget_size(type_id);

and use this info to detect the exact types. For example:

  if class_id == H5T_BITFIELD {
    stype = "b1";
  }
  elif class_id == H5T_INTEGER {
    // Get the sign
    sign = H5Tget_sign(type_id);
    if (sign > 0):
      stype = "i%s" % (itemsize);
    else:
      stype = "u%s" % (itemsize);
  }
  elif class_id == H5T_FLOAT {
    stype = "f%s" % (itemsize)
  }
  elif class_id == H5T_COMPOUND {
  ...

and so on so forth.

Cheers,

···

--

0,0< Francesc Altet http://www.carabos.com/

V V Cárabos Coop. V. Enjoy Data
"-"

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.