Hi quincey,
there's really not much more than that. Probably it's my mistake though. If
I create a datatype like
m_MyFileclass = H5Tcreate (H5T_COMPOUND, sizeof(int) + sizeof(double) );
H5Tinsert(m_MyFileclass , "m_double", 0, H5T_NATIVE_DOUBLE);
H5Tinsert(m_MyFileclass , "m_int", sizeof(double), H5T_NATIVE_INT);
and use that one to create the dataset and the normal one to write and read,
the data is mapped correctly. I just had the impression that this mapping
was done internally, i.e. the file data type does not account for the
offsets as laid out in the memory structure. So I assume in the previous
case when I read, it reads everything into a buffer of sizeof(Myclass) and
overwrites with that all data.
Thanks a lot1
-- dimitris
2010/3/4 Quincey Koziol <[email protected]>
> Hi Dimitris,
>
> On Mar 4, 2010, at 3:45 AM, Dimitris Servis wrote:
>
>
> Hi all,
>
> it is mentioned in
> http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetPreserve that
> H5Pset_preserve is deprecated. I save a class like this one:
>
> class Myclass
> {
> std::string m_classname;
> double m_double;
> int m_int;
> std::string m_base;
> std::vector<double> m_vector;
> }
>
> It's really a POD class. My compound data type looks like this:
>
> m_Myclass = H5Tcreate (H5T_COMPOUND, sizeof(Myclass));
> H5Tinsert(m_Myclass, "m_double", HOFFSET(Myclass, m_double),
> H5T_NATIVE_DOUBLE);
> H5Tinsert(m_Myclass, "m_int", HOFFSET(Myclass, m_int), H5T_NATIVE_INT);
>
> when I load it back, the double and the int are correctly read, but the
> whole object is initialized to something else and therefore completely
> destroyed.... any similar expereinces?
>
>
> Hmm, how is your dataset stored? Can you send us a simple example program
> that shows the problem?
>
> Quincey
>
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
>
>
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org