serialization binary_oarchive without signature?
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? 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? thanks, -- 10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail +++ GMX - die erste Adresse f�r Mail, Message, More +++
relative@gmx.net 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
participants (2)
-
relative@gmx.net
-
Robert Ramey