Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-11-03 18:21:54


relative_at_[hidden] wrote:
> i'd like to use boost serialization to serialize > 1 independent
> objects to a large file through a seekable stream, i.e. > 1
> serialization archives in one file.
> can you turn off the archive signature("serialization::archiv") at the
> beginning of the output, or do I have to write my own archive class
> for that?

Open the archive with the "no_header" flag.

> and 2nd, is there a way(except serializing to a std::stringstream) to
> find out the archive size beforehand, e.g. an archive class which
> doesn't really serialize things but add up the size in bytes of the
> binary output?

No you would have to make one. Doesn't seem that it would be too hard.
It also seems like it could be quite useful. My suggestion:

a) using strstream as a model, make streambuf derivation which just throws
away the characters.
b) add a couple of useful utility functions like crc(), length(), etc.

Then:

create a null_stream similar to strstream

and use xml_oarchive(null_stream) for output

Basically this would be a question of making a null stream. Since the
included archives
can use anything derived from std::ostream, you'd be done.

Good luck,

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