Boost logo

Boost Users :

From: Jabe (tahoma_at_[hidden])
Date: 2006-06-23 02:25:56


Robert Ramey wrote:

> Your idea of what an XML archive should look like is quite different than
> the one I implemented. So I don't think you would want to derive from
> xml_[i/o]archive. Take basic_xml_oarchive<Archive> as a starting point
> and make your own version.
>
> Note that my version was very much focused on permitting xml archives of
> arbitrary size without having to load the whole xml tree. I would hope
> that its possible to implement your own with the facilities that the
> library
> includes for creating archives. Of course no one can know until you try.

I try. But up to the moment i'm quite confused :)

>> maybe a first question: why don't i get a classname for each
>> serialized object in
>> common_oarchive::save_override(const class_name_type & t, int)?
>> sometimes i get a class_id, sometimes a class_reference_id and so on.
>> classnames
>> are offered rarely.
>
> In general, archives include only that which is necessary for
> de-serialization.
>
> There is a type "class_name_optional" which is serialized with the class
> name for every type. The default implementation is to ignore it - and
> none of the included archives override the
> default.

Where is this type defined and which method do i have to override?

> class_id etc are only applicable to classes - not primitives. They might
> not be available for all types - depending on the implementation level - I
> would have to investigate that.

All classes i use are exported by BOOST_CLASS_EXPORT_GUID. Is there a chance
to fetch the classname for a given class_id, class_id_reference or
class_id_optional on the level of archive derivation?

Until now I've derived three classes from boost::archive:

class my_basic_xml_oarchive : public detail::common_oarchive<Archive>
class my_xml_oarchive_impl : public basic_text_oprimitive<std::ostream>,
                             public my_basic_xml_oarchive<Archive>
class my_xml_oarchive : public my_xml_oarchive_impl<my_xml_oarchive>

And more general: How can i create objects from the registered information
about classes using the extended type info? When using the boost::archive
is not practical for my xml format i would like to use as much as possible
from boost to port the already implemented solution by myself without
boost. Therefore i need to replace my own classfactory if possible with
boost's one.

I found the struct "save_array_type" in detail/oserializer.hpp. If i could
replace the invoke method with my own (and so for all other savers) i could
remove e.g. the "item" xml tags used with array elements. Any chance?

Regards,
Jabe


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