How do I distingush between Datasets of NATIVE_HBOOL & NATIVE_CHAR?

Using the C++ API, I'm writing datasets in a group to an HDF5 file. When
I read the file I've written, I look at each of the objects in the group,
and compare the reported type of the dataset with one of the datatypes
defined in
H5::PredType. For example:

H5::Group group = H5File->openGroup(GroupName);
for(unsigned int I = 0; I < group.getNumObjs(); i++)
  {
  H5std_string name = group.getObjnameByIdx(I);
  std::string path = GroupName;
  path += "/";
  path += name;
  H5::DataSet curDS = H5File->openDataSet(path);
  H5::DataType curType = curDS.getDataType();

  if(curType == H5::PredType::NATIVE_HBOOL)
    {
    // handle bool
    }
  else if(curType == H5::PredType::NATIVE_CHAR)
    {
    // handle char
    }
  }

The problem is the char DataSet I wrote reports a type that's equal to
H5::PredType::NATIVE_HBOOL.

When I trace into the library, it appears they both have an underlying
INTEGER type, and are judged by H5Tequal to be the same, which seems wrong.

···

--
Kent Williams norman-k-williams@uiowa.edu

________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
________________________________

If you look at the size, there will be a difference. The NATIVE_HBOOL is 4 bytes... which means it can be confused with Int32.

I have written code which will convert .NET to & from HDF types and this is a big conflict. There are several primitive type cases for which there is not a 1:1 correspondence. I ended up having to define special cases. I ended up stuffing the bool into an NATIVE_UCHAR (unsigned 1 byte Integer), which means I lose the use of uchar and uint8.

Scott

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-
bounces@hdfgroup.org] On Behalf Of Williams, Norman K
Sent: Tuesday, April 19, 2011 3:41 PM
To: HDF Users Discussion List
Subject: [Hdf-forum] How do I distingush between Datasets of
NATIVE_HBOOL & NATIVE_CHAR?

Using the C++ API, I'm writing datasets in a group to an HDF5 file.
When
I read the file I've written, I look at each of the objects in the
group,
and compare the reported type of the dataset with one of the datatypes
defined in
H5::PredType. For example:

H5::Group group = H5File->openGroup(GroupName);
for(unsigned int I = 0; I < group.getNumObjs(); i++)
  {
  H5std_string name = group.getObjnameByIdx(I);
  std::string path = GroupName;
  path += "/";
  path += name;
  H5::DataSet curDS = H5File->openDataSet(path);
  H5::DataType curType = curDS.getDataType();

  if(curType == H5::PredType::NATIVE_HBOOL)
    {
    // handle bool
    }
  else if(curType == H5::PredType::NATIVE_CHAR)
    {
    // handle char
    }
  }

The problem is the char DataSet I wrote reports a type that's equal to
H5::PredType::NATIVE_HBOOL.

When I trace into the library, it appears they both have an underlying
INTEGER type, and are judged by H5Tequal to be the same, which seems
wrong.

--
Kent Williams norman-k-williams@uiowa.edu

________________________________
Notice: This UI Health Care e-mail (including attachments) is covered
by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is
confidential and may be legally privileged. If you are not the
intended recipient, you are hereby notified that any retention,
dissemination, distribution, or copying of this communication is
strictly prohibited. Please reply to the sender that you have received
the message in error, then delete it. Thank you.
________________________________

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender.
Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.