|
Boost : |
From: Ehsan Akhgari (ehsan_at_[hidden])
Date: 2003-10-11 11:20:37
> I've uploaded a new version of the zipstream (see link below)
Nice!
> - the library is now fully "policized": to add a new compression
> algorithm, you (basically) need to write to small policy classes.
> - bzip2 library added
> - adds compress, decompress methods. For example, to compress
> a stream to
> another:
>
> gzip_compressor gz;
> compress( input_stream, output_stream, gz) ;
>
> and decompress
> gzip_decompressor dgz;
> decompress( compress_intput_stream, output_stream, dgz);
>
> More suggestions :)
The above two functions require the data to be compressed/decompressed
from from an input stream. That is fine for compressing/decompressing
files, for example, but it's not as generic as it would be. What I
exactly had in mind was some more STL-ish, like:
template < class Policy, class InputIterator, class OutputIterator >
void compress(InputIterator begin, InputIterator end, OutputIterator
out);
template < class Policy, class InputIterator, class OutputIterator >
void decompress(InputIterator begin, InputIterator end, OutputIterator
out);
// to use:
compress< gzip_compressor >(in_stream.begin(), in_stream.end(),
out_stream.begin()); decompress< gzip_decompressor >(in_stream.begin(),
in_stream.end(), out_stream.begin());
And then we can have convenience inline functions such as:
template < class InputIterator, class OutputIterator >
inline void gzip_compress(InputIterator begin, InputIterator end,
OutputIterator out) {
compress< gzip_compressor, InputIterator, OutputIterator >
(begin, end, out);
}
// ditto for gzip_decompress
Of course I'm speaking from the user's point of view, so I don't know
how feasible these are to implement.
-------------
Ehsan Akhgari
List Owner: MSVC_at_[hidden]
[ Email: ehsan_at_[hidden] ]
[ WWW: http://www.beginthread.com/Ehsan ]
'I generally take life as it comes my way', said Death.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk