From: JOLY Loic (loic.joly_at_[hidden])
Date: 2003-11-12 10:30:58
Robert Ramey wrote:
> JOLY Loic wrote:
>>What I need is self-contained data. For instance, when I send an object
>>on the network, I do not want any globally shared table of object
>>references, or class definition, to be generated.
> Default is versioning enable and tracking of object serialized through
> pointers. These can be changed on a class by class basis.
> No global tables are maintained. All tables are part of the
> archive instance which typically is destroyed as soon as the
> data is serialized.
That was what I meant by "globally shared". I am afraid that these
tables might create some size overhead that is detrimental to our
application that is slightly "network bandwidth limited".
> For versioning and tracking turned off - not
> even these temporary tables are generated.
>>I believe that the object_serializable implementation level could help
>>me in that respect, but would like to specify it not at the class level,
>>but at the archive level. That way, I am sure all classes sent to my
>>archive behave correctly. Is this possible ?
> Honestly it never crossed my mind that someone would want to do this.
> A stated goal of the system is that once serialization works with one
> archive it works the same with all archives. So this was never considered.
> Since you have to specify a serialize function for each class - I wouldn't
> think there there would be much of an issue with specifying two more lines
> per class header to specify the desired serialization traits - it would also document
> your implementation.
What I had in mind was to allow a class to be serialized both on the
network, and in a file, but different data need to be saved in each case.
For instance, a class that tracks a position in real time might need to
serialize the following data when sent on the network : X, Y,
timeOfUpdate, speedX and speedY (the 3 last numbers are used for
But, when saved into a file, the same class might only need to contain X
One could argue that in this case, two different classes might be a
solution, but if I already have a vector of position, I do not want to
create a vector of positionLikeClassDesignedToBeSavedInAFile just for
Version tracking is also something that I do not want to pay for when I
send data on the network (I can ensure that client and server will run
in the same version), but that I want to have when writing in files (I
cannot ensure that our user won't try to open old files).
For the first kind of difference, I believe that a specialisation of
MyClass::serialize for specific archives could do the trick, but
BOOST_CLASS_IMPLEMENTATION does not in any way that I can see depend on
the underlying archive class.
> It would also make it easier to debug as you might
> want to direct it to a text or xml file to check it but use a binary stream
> for the production application.
Sure, the default should be that the class is serialized the same on all
archives, but I would appreciate if it was possible :
- Either to write an archive that has enough knowledge to keep only
- Or to specify that a class can be serialized differently on different
>>Do you think I could use serialisation to achieve my goals ? Do you
>>think there is another point I forgot ?
> Our intention is that it support this kind of application. You'll just have try it.
> As you are breaking new ground here, It could well be that something has been
> overlooked. I would recommend making a small simple example to prove the
> concept. If this is not easy, we would be very interested in hearing about it.
> It would flush out an questions, bugs, documentation failings etc.
No problems, I will keep you informed.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk