Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-07-26 12:13:34


"William Bardon" <wbardon_at_[hidden]> wrote in message
news:C73E689C9FCF884B9A550ECFADA0721C087D3E_at_exchange.cab-cds.org...
I have read both the Boost Serialization online documentation and the
archives of the Boost-Users mailing list looking for guidance, but I haven't
found anything relevant. I see how to use BOOST_CLASS_TRACKING and
BOOST_CLASS_IMPLEMENTATION to remove version tracking attributes from the
XML tags.

Usage of these macros does a lot more than remove attributes from the tags.

I want to go in the opposite direction. I notice that the class_id and
version attributes only appear the first time an object of a particular
class is serialized. I want to force the version attribute to appear in
every object's attribute list.

Do I need to derive a custom archive to do this?

yes

I have looked at the source code for serialization, but I have trouble
plowing through all of the macros, template expansions, and overloaded
functions to locate the specific part that controls whether class traits are
stored as attributes in a particular XML tag.

I sympathize - its hard to follow. And I wrote it. Here are some hints:

a) look at demo_fast_archive.cpp to see a model of how one can derive from
an existing archive.
b) You'll want to derive from xml_oarchive_impl<...> to create
my_xml_oarchive
c) add a "save_override" function to my_xml_oarchive which replaces the
"save_override" function in
    basic_xml_oarchive.ipp. Implement this using functions defined
basic_xml_oarchive.ipp

Good luck -

Robert Ramey

Thanks in advance,
Bill

_______________________________________________
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