Subject: Re: [boost] [serialization] In-memory archive?
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-10-20 09:17:03


Ling Li wrote:
> On Fri, Oct 17, 2008 at 12:42 PM, troy d. straszheim
> <troy_at_[hidden]> wrote:
>> Ling Li wrote:
>>> Thanks! Using streambuffer or std::istringstream/std::ostringstream is
>>> indeed very convenient.
>>>
>>> Has anyone thought about introducing default values in serialization
...
>
> Sorry that I didn't make myself clear. I meant to reduce the archive
> size (not count the size). For example, in demo_gps.hpp, instead of
> ar & boost::serialization::make_nvp("hour", hour)
> one might want to use
> ar & boost::serialization::make_nvp("hour", hour, 11)
> so that if the hour is 11, it is not serialized in the archive. During
> deserialization, if the hour is missing in the archive, 11 will be the
> default value.

If you want more compact archives don't use xml. Use either text or
portable_binary(or plain binary for homogenous platforms). Additionally
you can use these with boost.iostreams compressed filters.

The structure of your class heirarchy drives the output/input of archive
data. They only optional aspect is to use the versioning facility.

Jeff