Scott,
I agree about the enum size. It was the returned value of the call to
attr.getInMemDataSize(). Sorry for the misinformation.

The call to:

int i;
attr.read(PredType::NATIVE_INT, &i)

causes a crash. That is not surprising because of the size discrepancy. But
I also tried to use all kinds of 8bit creatures,
like char, uchar, bool, replacing NATIVE_INT by NATIVE_CHAR, etc., but they
all ended up with a crash.

Thanks,
Yury



On Wed, Jul 24, 2013 at 1:57 PM, Mitchell, Scott - IS <
[email protected]> wrote:

>  I don’t think enums are stored as 1byte. You can check with H5T.getsize.
>
>
>
> What happens if you try your read with *attr_type* as a NATIVE_INT and* i*as 
> an int? Then cast it to bb.
>
>
>
>
>
> Scott
>
>
>
> *From:* Hdf-forum [mailto:[email protected]] *On
> Behalf Of *Yury Girshovich
>
> *Sent:* Wednesday, July 24, 2013 1:04 PM
> *To:* [email protected]
> *Subject:* [Hdf-forum] Reading enum bool attribute
>
>
>
> I am trying to read an attribute defined as
>
>
>
> typedef enum {bbo=false, bb1=true} bb;
>
>
>
> as
>
>
>
> bb i;
>
> attr.read(attr_type, &i);
>
> The size of the attribute value is 1 byte.
>
>
>
> For attr_type I tried all kinds of 8 bit predicate types (as one advice
> suggested use int, and then interpret your data),
>
> bur no matter what I do the code crashes.
>
> The value is inserted in a different code using Python, so I can get no
> help from there.
>
> How should I define the predicate type then?
>
> Thanks
>
>
>
> ------------------------------
>
> 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 Exelis
> Inc. The recipient should check this e-mail and any attachments for the
> presence of viruses. Exelis Inc. accepts no liability for any damage caused
> by any virus transmitted by this e-mail.
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
>
> http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
>
>
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to