Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization] Attaching arbitrary data to an archive
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-06-01 14:41:17


On Tue, Jun 1, 2010 at 10:35 AM, Noah Roberts <roberts.noah_at_[hidden]> wrote:
> Sometimes during serialization an object needs to know a lot more than
> it does during normal operation.  The way I've dealt with this in the
> past is to subclass the archive I want to use and add setter/getters for
> the data that various objects down the line are going to need to store
> and retrieve themselves.
>
> Is there a better way though, something that's built into the library
> already maybe?  I don't see anything but I thought I'd ask.

In my own serialization library I have a system similar to the one
used in Boost Exception that allows exception objects to carry
arbitrary data: all my archive types implement this functionality.

For example, this has allowed my shared_ptr serialization
implementation to be decoupled from the serialization library itself,
not to mention things like reading and writing DirectX textures (which
need a D3D device object), etc.

Perhaps boost::serialization can benefit from a similar approach. I
can upload some source code if there is interest.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


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