Boost logo

Boost :

From: Murray, Peter C (Peter.Murray_at_[hidden])
Date: 2001-02-14 18:55:42


With regard to the disussions on compression, would a more elegant approach
be to create some form of compressing stream manipulator? I admit that I am
particularly weak on streams, so apologies if I am proposing something
impossible...

Conceptually, I'd like to do something like this:

outfile << encrypt<DES> << compress<ZIP> << myClass;
infile >> decrypt<DES> >> decompress<ZIP> >> myClass;

What do people think of this approach, if its even possible?
- Peter.

-----Original Message-----
From: Jens Maurer [mailto:Jens.Maurer_at_[hidden]]
Sent: Thursday, February 15, 2001 3:52 AM
To: boost_at_[hidden]
Subject: Re: [boost] Anyone planning a compression library?

"Murray, Peter C" wrote:
>
> Has anyone thought about a standard compression library for boost? Maybe
> something comapatable with gzip or maybe even a number of compression
> policies?

Sounds like a good idea.

If you want to limit yourself to just a gzip-like compressor, that's fine,
but should be explicitly stated. Someone may want to look at a general
approach how streaming and compression/encryption/checksumming can be
cleanly separated. However, that separation is not a requirement for your
submission of a gzip-like compressor.

I believe the compressor should be implemented as a streambuf filter,
i.e. taking another streambuf as its source/drain for compressed data.

basic_streambuf has two template parameters, charT and Traits, which you
may want to observe. In particular, Traits::compare and Traits::assign seem
to be useful.

Jens Maurer


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk