Boost logo

Boost Users :

Subject: [Boost-users] [Serialization] Avoiding multiple de-serialization
From: beet (r.berlich_at_[hidden])
Date: 2014-03-11 05:11:07


Dear Boost-Community,

I have a large, "directed" tree-like data structure (i.e., no cycles),
holding boost::shared_ptr's either to container-objects or
"leaf-objects", i.e. individual objects not holding other objects. All
shared_ptr's hold base-pointers, i.e. the leaf-objects share a common
base type, but not much else.

I would now like to collect statistics on some of the leaf-objects
during the program run. In order to do this, I'm storing
boost::shared_ptr's to the leaf objects in a container outside of the
tree. Getting access to the leaf objects would otherwise be very
inefficient, as the tree can have virtually any geometry (except for
cycles), and I do not know the geometry in advance.

The tree is repeatedly (de-)serialized, and I would like to also
(de-)serialize the top-level container, so I still have easy access to
the leaf-objects after de-serialization.

However, it is not clear to me what happens to the leaf-objects after
de-serialization of both the tree and the external container.

Will the leaf-objects be de-serialized twice ? Or might there be
different leaf-objects in the external container and in the tree ?

Thanks for any insight you may provide.

Best Regards,
beet


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net