From: Matthias Troyer (troyer_at_[hidden])
Date: 2002-01-25 15:55:56
Dear Jens, dear Boosters
> This is unfortunately true. I meant to do something about this
> for a long time, but never got around to actually doing
> something. Sorry.
We all know how hard it is to find time
>> i) I often have to (de)serialize large arrays of numbers, for which an
>> optimized function should exist that can (de)serialize a C-array in
>> one function call. This also allows support for data formats such
> You should be able to partially specialize the (de)serialization
> functions on something like
> double (&)[n]
> where n is a template parameter.
Unfortunately not, since n is not a compiletime-constant in all cases.
Thus we need extra read/write functions that take n as a second argument
>> ii) (De)serialization of pointers
> Cyclic stuff as well?
No, at the moment I added support for that on top of my library.
I register each object to which I want pointers written, and can then
serialize a unique identifier instead of the pointer. The reverse happens
at deserialization. I do not want this to be done automatically for
any object since that would incur too much overhead.
>> iii) using runtime polymorphism with the persistence library. At the
>> only compile time polymorphism is implemented, and the
>> needs to be chosen at compile time.
> Writing is easy.
> What about this for reading:
> Overload the global fucntion that the readers/writers delegate to on
> a "Base *&". When the system needs to read a "Base *", it calls this
> function. Then, you know your base type, and you can use any
> fancy virtual constructor approach that you prefer to create your
> "Derived*" and assign it to the "Base *" variable.
For writing the object first writes an identifier, identifying the
derived type, and then serialize the object. For deserializing i first
read that need a factory which creates the object and deserializes
My implementation used to be based on a pure virtual save() and load()
function in the Base class. This worked perfectly, however then all
the readers/writers need to be derived from a common base, which is not
case at the moment. This needs some further thought.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk