|
Boost Users : |
From: Scott Howlett (boost_at_[hidden])
Date: 2008-04-27 15:45:56
Thanks! That's basically what I have done. My derived Archive is a
wrapper that can be put around any underlying Archive.
Scott
Robert Ramey wrote:
> Make your own archive derived from one of the archives along with your own
> helper. This technique is used in the current archive to implement
> the special case of shared pointers - which do not model model
> the serializablt concept. You can do the same thing with your own
> "special types"
>
> Robert Ramey
>
>
> Scott Howlett wrote:
>> Hello,
>>
>> In a recent post, I asked whether it was possible to swap deserialized
>> pointer values for already-existing ones so I could merge the incoming
>> data with objects already in memory. I guess the answer is no...
>>
>> An alternative is to serialize some other identifier instead of
>> writing pointers, and then on de-serialization I find my existing
>> objects via those identifiers. This works fine, but it leads to
>> another question:
>>
>> How do I make my internal objects available to the deserialization
>> routines so that they have an opportunity to look up the necessary
>> information? Or more generally, How do I do stateful serialization /
>> deserialization? For example, maybe I want to supply options that
>> fine-tune how my data is serialized or deserialized.
>>
>> The only parameter that is passed around to all the serialization
>> functions is the Archive, so if I want to add options or other context
>> information, it seems like I should add this to the Archive. That's
>> simple enough to do; I just made a wrapper Archive that can sit atop
>> any other Archive and contain any other options / context data I need.
>>
>> On the one hand it seems sneaky to hijack the Archive for this
>> purpose, but on the other hand iostreams do basically the same thing
>> via the various ios_base calls (setf, width, precision, etc.) so
>> maybe it's not so bad.
>>
>> Am I perhaps overlooking some facility already present in the
>> serialization library?
>>
>> Thanks,
>> Scott
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
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