Getting type of a Varlen

Hello,

I am reading an attribute as a Varlen using code like

  auto metadata=dataset.openAttribute ("METADATA");
  H5::VarLenType type=metadata.getVarLenType ();
  hvl_t varlen;
  metadata.read(type, &varlen);

How do I find out what type the VarLenType is based on? I have tried
getSuper(), getTag(), fromClass(), and operator==(), and none of them
seem to work for me. Are there any examples of how to introspectively
figure out what the type is?

Thank you,
Walter Landry

Hello Walter,

Would AbstractDs::getTypeClass() give you the information you need?

​Binh-Minh

···

________________________________________
From: Hdf-forum <hdf-forum-bounces@lists.hdfgroup.org> on behalf of Walter Landry <wlandry@caltech.edu>
Sent: Thursday, September 24, 2015 8:51 PM
To: hdf-forum@lists.hdfgroup.org
Subject: [Hdf-forum] Getting type of a Varlen

Hello,

I am reading an attribute as a Varlen using code like

  auto metadata=dataset.openAttribute ("METADATA");
  H5::VarLenType type=metadata.getVarLenType ();
  hvl_t varlen;
  metadata.read(type, &varlen);

How do I find out what type the VarLenType is based on? I have tried
getSuper(), getTag(), fromClass(), and operator==(), and none of them
seem to work for me. Are there any examples of how to introspectively
figure out what the type is?

Thank you,
Walter Landry

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Thank you. That works for the attribute and gave me the necessary
hint for the VarLenType. To get the type that the VarLenType is based
on, I can run DataType::getSuper().getClass(). Then to actually
construct the type (for example, if it is a CompType), then I can use
DataType::getSuper().getClass().getId() in the CompType constructor.

Cheers,
Walter Landry

···

Binh-Minh Ribler <bmribler@hdfgroup.org> wrote:

Hello Walter,

Would AbstractDs::getTypeClass() give you the information you need?

That's good! Thanks, Walter!

​Binh-Minh

···

________________________________________
From: Hdf-forum <hdf-forum-bounces@lists.hdfgroup.org> on behalf of Walter Landry <wlandry@caltech.edu>
Sent: Friday, September 25, 2015 9:45 AM
To: hdf-forum@lists.hdfgroup.org
Subject: Re: [Hdf-forum] Getting type of a Varlen

Binh-Minh Ribler <bmribler@hdfgroup.org> wrote:

Hello Walter,

Would AbstractDs::getTypeClass() give you the information you need?

Thank you. That works for the attribute and gave me the necessary
hint for the VarLenType. To get the type that the VarLenType is based
on, I can run DataType::getSuper().getClass(). Then to actually
construct the type (for example, if it is a CompType), then I can use
DataType::getSuper().getClass().getId() in the CompType constructor.

Cheers,
Walter Landry

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5