|
Boost Users : |
Subject: Re: [Boost-users] [iostreams] [archive] [serialization] lexical_cast<string> with binary_archive vs. text_archive
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-08-23 04:28:55
I don't see what lexical cast is doing in there.
What's the matter with:
> numerics -> binary_archive -> gzip -> out_file
> io::filtering_ostream fos;
> fos.push(io::gzip_compressor());
> fos.push(io::file_sink("output.txt.gz", ios::binary));
> ar::binary_oarchive oa(fos);
?
Robert Ramey
Johann Goetz wrote:
> Consider the following serialization archive. I can serialize a
> collection of variables (floats, ints, etc) through the series:
> numerics --> text_oarchive --> gzip --> output_file
> The text_archive step is essentially a stringstream filter. This
> filter gives the serialization the portability I (sometimes) need.
>
> namespace io = boost::iostreams;
> namespace ar = boost::archive;
>
> io::filtering_ostream fos;
> fis.push(io::gzip_compressor());
> fis.push(io::file_sink("output.txt.gz"));
> ar::text_oarchive oa(fos);
>
> OK. Now what I wish to do is to create a binary_archive and to push
> the stringstream filter to the filtering_ostream:
> numerics -> binary_archive -> lexical_cast<string> -> gzip -> out_file
> This way I could turn this part (and the gzip) on or off at will (the
> ol' speed vs portability thing):
>
> io::filtering_ostream fos;
> fis.push(/*stringstream_filter*/);
> fis.push(io::gzip_compressor());
> fis.push(io::file_sink("output.txt.gz"));
> ar::binary_oarchive oa(fos);
>
> I am not sure how to create such a filter, but I'm guessing such a
> filter already exists. Perhaps the answer lies in
> lexical_cast<string>? any help with this would be greatly
> appreciated, thanks!
> Johann.
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