Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-04-28 23:36:15


Denis Kuznetsov wrote:
> Hi,
>
> I want to write my own archive class for reading/writing to some
> defined binary protocol.
> I'm deriving my archive class from the binary_oarchive_impl template
> and overriding save_override functions.
> As protocol is defined, I don't need any additional info(bytes). So I
> do smth like this:

I'm skeptical that this can be done.

> // all the functions have emtpy body
> void save_override(const class_id_optional_type &, int) {}

no problem - optional

> void save_override(const version_type&, int) {}

no versioning - load should be implemented to always return 0

> void save_override(const class_id_type&, int) {}
> void save_override(const class_id_reference_type&, int) {}

not sure.

> void save_override(const object_id_type&, int) {}

not sure

> void save_override(const object_reference_type&, int) {}

better have tracking turned off - then this as well as corresponding load
should never be called.

> void save_override(const tracking_type&, int) {}

not sure - maybe load can always return no_tracking

> void save_override(const class_name_type&, int) {}

only used for exporting pointers. so you wont' be able to do that.

> public:
> fast_binary_oarchive(std::ostream & os, unsigned flags =
> no_header | no_codecvt | no_xml_tag_checking | no_tracking) :
> binary_oarchive_impl<derived_t>(os, flags)
> {}

no_tracking is not implemented has no effect

> };
>
> Is this correct? What features of the serialization library will not
> I be able to use?

As I said - I don't think this can be made to work without delving
into the the internals of the library - but maybe I'm wrong.

Robert Ramey


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