Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-02-27 04:04:44


rameysb wrote:
> Fellow programmers
>
> I have just uploaded my proposal for a boost library to address
> saving and restoring of C++ objects. I refer to this as
> serialization.

But you forgot to give the URL :-)
(which is http://groups.yahoo.com/group/boost/files/serialization.zip)

> After much effort I managed to get this working to fullfill all the
> requirements below:
> [snip]

I have the following comments:

1. It would be much better to stick to the scheme with one function
'desciribe'. This would allow to reduce code size needed to make an object
serializable, and will also allow using the same 'describe' function with
other classes. Is there any problems that I've missed? (but see point 4 below)

2. Likewise, is it always needed to declare external save/load functions as
members of serialization class<>. Can't they also be a free standing
functions?

3. Example says:

    ar << "* static_cast<const bus_stop *>(this);"

So, we output a *reference* to an object. Docs don't make it clear if storing
the same object twice in this manner is OK. For example, is it safe to store
virtual base classes? If no, it should be document. If yes, how is this
accomplished. Is address of *any* stored object remembered? Isn't that
inefficient?

4. Versioning is completely omitted from documentation. How does it work? Can
I disable it completely? Oh... and now I sense some problem with 'describe'
method -- it will have to describe specified version of a file. And what to
do with member variables with were added in the last version? 'load' version
can contain arbitray logic to set their values. 'describe' will have no way
to do it, so we'll have to either rely on defaul-initialization to be ok, or
provide and additional function which does 'fixup' after a old version of
class was loaded.

5. The code does not compile under g++ 3.0. For example, lines
178,202, 206, of serialization.hpp refers to 'serialization<T>' before
defining any template of that name.
lines 226, 235, 244, 269 miss "typename".
If you fix the first problem, I'll probably be able to handle other myself.

- Volodya


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