Public Member Functions | Protected Attributes

CCompressor Class Reference


Detailed Description

Compression library for compressing and decompressing buffers using one of the standard compression algorithms, LZO, GZIP, BZIP2 or LZMA.

The general recommendation is to use LZO whenever lightweight compression is sufficient but high i/o throughputs are needed (at 1/2 the speed of memcpy).

If size is all that matters use LZMA (which especially when compressing can be very slow though).

Note that besides lzo compression, this library is thread safe.

Definition at line 49 of file Compressor.h.

Inheritance diagram for CCompressor:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CCompressor (void)
 CCompressor (E_COMPRESSION_TYPE ct)
virtual ~CCompressor ()
void compress (uint8_t *uncompressed, uint64_t uncompressed_size, uint8_t *&compressed, uint64_t &compressed_size, int32_t level=1)
void decompress (uint8_t *compressed, uint64_t compressed_size, uint8_t *uncompressed, uint64_t &uncompressed_size)
virtual const char * get_name () const

Protected Attributes

E_COMPRESSION_TYPE compression_type

Constructor & Destructor Documentation

CCompressor ( void   ) 

default constructor

Definition at line 38 of file Compressor.cpp.

default constructor

Parameters:
ct compression to use: one of UNCOMPRESSED, LZO, GZIP, BZIP2 or LZMA

Definition at line 59 of file Compressor.h.

virtual ~CCompressor (  )  [virtual]

default destructor

Definition at line 64 of file Compressor.h.


Member Function Documentation

void compress ( uint8_t *  uncompressed,
uint64_t  uncompressed_size,
uint8_t *&  compressed,
uint64_t &  compressed_size,
int32_t  level = 1 
)

compress data

compresses the buffer uncompressed using the selected compression algorithm and returns compressed data and its size

Parameters:
uncompressed - uncompressed data to be compressed
uncompressed_size - size of the uncompressed data
compressed - pointer to hold compressed data (returned)
compressed_size - size of compressed data (returned)
level - compression level between 1 and 9

Definition at line 44 of file Compressor.cpp.

void decompress ( uint8_t *  compressed,
uint64_t  compressed_size,
uint8_t *  uncompressed,
uint64_t &  uncompressed_size 
)

decompress data

Decompresses the buffer using the selected compression algorithm to the memory block specified in uncompressed. Note: Compressed and uncompressed size must be known prior to calling this function.

Parameters:
compressed - pointer to compressed data
compressed_size - size of compressed data
uncompressed - pointer to buffer to hold uncompressed data
uncompressed_size - size of the uncompressed data

Definition at line 209 of file Compressor.cpp.

virtual const char* get_name ( void   )  const [virtual]
Returns:
object name

Implements CSGObject.

Definition at line 98 of file Compressor.h.


Member Data Documentation

compressor type

Definition at line 102 of file Compressor.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation