Compound data type member insertion in C++

Hi,

I'm assessing C++ HDF5 API under VS C++/Windows.
My code is working when I compile it in debug mode (_DEBUG preprocessor
definition set) but I encounter some issues when using release mode (NDEBUG
set).

The issue is that I cannot use the insertMember method for CompType object.

I've created a Vector3DDT CompType object with size sizeof( Vector3D ).
Vector3D is a struct with 3 double member x, y, z.

When I execute the following :
Vector3DDT.insertMember( "x", HOFFSET( Vector3D, x ),
PredType::NATIVE_DOUBLE );
Vector3DDT.insertMember( "y", HOFFSET( Vector3D, y ),
PredType::NATIVE_DOUBLE );
I get an error that member name is not unique for "y" member
I verified using getMemberName method that at that time I really have one
unique member called "x".
So the error message seems to be erroneous itself.

I got a little bit deeper in the issue and tried to use the C functions :
H5Tinsert( Vector3DDT.getId(), "x", HOFFSET( Vector3D, x ), (
PredType::NATIVE_DOUBLE ).getId() );
H5Tinsert( Vector3DDT.getId(), "y", HOFFSET( Vector3D, y ), (
PredType::NATIVE_DOUBLE ).getId() );
H5Tinsert( Vector3DDT.getId(), "z", HOFFSET( Vector3D, z ), (
PredType::NATIVE_DOUBLE ).getId() );
and it worked perfectly... (I voluntarily used C++ accessors in order to
find the issue origin).

So it seems that the C++ interface for insertMember has some bug. Obviously,
I could have made a mistake in which case I would be grateful if you could
point on it !

Thanks,

Yves

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Compound-data-type-member-insertion-in-C-tp3398967p3398967.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Hi Yves,

Thank you for reporting the problem. It's probably a bug in insertMember.
I'll add it to our bug database and try to check it out soon. In the
meantime, please use the C function as you did.

Thanks,
Binh-Minh

···

-------------
The HDF Group

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-
bounces@hdfgroup.org] On Behalf Of rogez
Sent: Thursday, October 06, 2011 3:47 AM
To: hdf-forum@hdfgroup.org
Subject: [Hdf-forum] Compound data type member insertion in C++

Hi,

I'm assessing C++ HDF5 API under VS C++/Windows.
My code is working when I compile it in debug mode (_DEBUG preprocessor
definition set) but I encounter some issues when using release mode (NDEBUG
set).

The issue is that I cannot use the insertMember method for CompType object.

I've created a Vector3DDT CompType object with size sizeof( Vector3D ).
Vector3D is a struct with 3 double member x, y, z.

When I execute the following :
Vector3DDT.insertMember( "x", HOFFSET( Vector3D, x ),
PredType::NATIVE_DOUBLE );
Vector3DDT.insertMember( "y", HOFFSET( Vector3D, y ),
PredType::NATIVE_DOUBLE );
I get an error that member name is not unique for "y" member
I verified using getMemberName method that at that time I really have one
unique member called "x".
So the error message seems to be erroneous itself.

I got a little bit deeper in the issue and tried to use the C functions :
H5Tinsert( Vector3DDT.getId(), "x", HOFFSET( Vector3D, x ), (
PredType::NATIVE_DOUBLE ).getId() );
H5Tinsert( Vector3DDT.getId(), "y", HOFFSET( Vector3D, y ), (
PredType::NATIVE_DOUBLE ).getId() );
H5Tinsert( Vector3DDT.getId(), "z", HOFFSET( Vector3D, z ), (
PredType::NATIVE_DOUBLE ).getId() );
and it worked perfectly... (I voluntarily used C++ accessors in order to
find the issue origin).

So it seems that the C++ interface for insertMember has some bug.
Obviously,
I could have made a mistake in which case I would be grateful if you could
point on it !

Thanks,

Yves

--
View this message in context: http://hdf-
forum.184993.n3.nabble.com/Compound-data-type-member-insertion-in-C-
tp3398967p3398967.html
Sent from the hdf-forum mailing list archive at Nabble.com.

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

--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM

Thanks for your reply.

For that time it is not problematic for me, I've just put the insertMember
method into a macro which uses the right implementation depending on _DEBUG
preprocessor flag.

Regards,

Yves

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Compound-data-type-member-insertion-in-C-tp3398967p3399581.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Great! Thanks, Yves.

Binh-Minh

···

-----Original Message-----
From: hdf-forum-bounces@hdfgroup.org [mailto:hdf-forum-
bounces@hdfgroup.org] On Behalf Of rogez
Sent: Thursday, October 06, 2011 9:02 AM
To: hdf-forum@hdfgroup.org
Subject: Re: [Hdf-forum] Compound data type member insertion in C++

Thanks for your reply.

For that time it is not problematic for me, I've just put the insertMember
method into a macro which uses the right implementation depending on _DEBUG
preprocessor flag.

Regards,

Yves

--
View this message in context: http://hdf-
forum.184993.n3.nabble.com/Compound-data-type-member-insertion-in-C-
tp3398967p3399581.html
Sent from the hdf-forum mailing list archive at Nabble.com.

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

--
Internal Virus Database is out-of-date.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM