Boost logo

Boost :

From: Edgars Irmejs (edgars_at_[hidden])
Date: 2007-12-07 13:27:53


Boost Serialization library provides a great solution for serializing
derived classes by pointers to base classes, but I'm concerned with a
simple use case:
The program is being used on two computers "A" and "B" where "A" sends
data to "B" by the means of serialization. At some upgrade of the
program a serialized class "bus" is complemented with a derived class
"big_bus". Only computer "A" gets the new version. I don't want the
old version on "B" to dismiss a received "big_bus" object from "A", I
need to convert it into a "bus" class object. It is sometimes much
more useful to process the "big_bus" as a "bus" than not to process
at all.
I can assure serialization of each derivation starts with the
serialization of the base class. I'm also ready to cope with the
overhead of storing parent class information within the information
about the derived classes. And it's ok if multiple inheritance is out
of the question.
Is there a pattern, a proposed solution to allow this dynamic
"fallback" to base classes?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk