Yate
|
An abstract data (de)compressor. More...
#include <yateclass.h>
Public Member Functions | |
Compressor (const char *format, const char *name=0) | |
virtual | ~Compressor () |
const String & | format () const |
virtual bool | init (bool comp=true, bool decomp=true, const NamedList ¶ms=NamedList::empty()) |
virtual void | finalize (bool comp) |
virtual int | compress (const void *buf, unsigned int len, DataBlock &dest) |
virtual int | decompress (const void *buf, unsigned int len, DataBlock &dest) |
virtual int | writeComp (const void *buf, unsigned int len, bool flush)=0 |
int | writeComp (const DataBlock &data, bool flush) |
int | writeComp (const String &data, bool flush) |
virtual int | readComp (DataBlock &buf, bool flush)=0 |
virtual int | writeDecomp (const void *buf, unsigned int len, bool flush)=0 |
int | writeDecomp (const DataBlock &data, bool flush) |
int | writeDecomp (const String &data, bool flush) |
virtual int | readDecomp (DataBlock &buf, bool flush)=0 |
Protected Attributes | |
String | m_format |
An abstract data (de)compressor.
The Compressor class provides an abstraction for data (de)compressor classes. The String component keeps an optional object name to be used for debug purposes
Compressor | ( | const char * | format, |
const char * | name = 0 |
||
) | [inline] |
Constructor
format | Compression format |
name | Optional object name |
virtual ~Compressor | ( | ) | [inline, virtual] |
Destructor
Compress the input buffer, flush all pending data, append compressed data to the received data block
buf | Pointer to input data |
len | Length of input in bytes |
dest | Destination buffer |
virtual int decompress | ( | const void * | buf, |
unsigned int | len, | ||
DataBlock & | dest | ||
) | [virtual] |
Decompress the input buffer, flush all pending data, append decompressed data to the received data block
buf | Pointer to input data |
len | Length of input in bytes |
dest | Destination buffer |
virtual void finalize | ( | bool | comp | ) | [inline, virtual] |
Finalize the (de)compression
comp | True to finalize compression, false to finalize decompression |
Retrieve (de)compressor format
virtual bool init | ( | bool | comp = true , |
bool | decomp = true , |
||
const NamedList & | params = NamedList::empty() |
||
) | [inline, virtual] |
Initialize
comp | True to initialize compressor |
decomp | True to initialize decompressor |
params | Optional parameters |
Read data from compressor. Append it to 'buf'
buf | Destination data block |
flush | True to flush all compressor input data |
virtual int readDecomp | ( | DataBlock & | buf, |
bool | flush | ||
) | [pure virtual] |
Read data from decompressor. Append it to 'buf'
buf | Destination data block |
flush | True to flush all decompressor input data |
virtual int writeComp | ( | const void * | buf, |
unsigned int | len, | ||
bool | flush | ||
) | [pure virtual] |
Push data to compressor. Flush compressor input if input buffer is NULL or the length is 0 and flush is true
buf | Pointer to input data |
len | Length of input in bytes |
flush | True to compress all now, false to let the compressor accumulate more data for better compression |
Push data to compressor
data | Input data block |
flush | True to compress all now, false to let the compressor accumulate more data for better compression |
References DataBlock::data(), DataBlock::length(), and Compressor::writeComp().
Referenced by Compressor::writeComp().
Push data to compressor
data | Input string |
flush | True to compress all now, false to let the compressor accumulate more data for better compression |
References String::c_str(), String::length(), and Compressor::writeComp().
Referenced by Compressor::writeComp().
virtual int writeDecomp | ( | const void * | buf, |
unsigned int | len, | ||
bool | flush | ||
) | [pure virtual] |
Push data to decompressor
buf | Pointer to input data |
len | Length of input in bytes |
flush | True to try to decompress all data |
int writeDecomp | ( | const DataBlock & | data, |
bool | flush | ||
) | [inline] |
Push data to decompressor
data | Input data block |
flush | True to try to decompress all data |
References DataBlock::data(), DataBlock::length(), and Compressor::writeDecomp().
Referenced by Compressor::writeDecomp().
int writeDecomp | ( | const String & | data, |
bool | flush | ||
) | [inline] |
Push data to decompressor
data | Input string |
flush | True to try to decompress all data |
References String::c_str(), String::length(), and Compressor::writeDecomp().
Referenced by Compressor::writeDecomp().