SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | 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]

Public Member Functions

 CCompressor ()
 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
- Public Member Functions inherited from CSGObject
 CSGObject ()
 CSGObject (const CSGObject &orig)
virtual ~CSGObject ()
virtual bool is_generic (EPrimitiveType *generic) const
template<class T >
void set_generic ()
void unset_generic ()
virtual void print_serializable (const char *prefix="")
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
void set_global_io (SGIO *io)
SGIOget_global_io ()
void set_global_parallel (Parallel *parallel)
Parallelget_global_parallel ()
void set_global_version (Version *version)
Versionget_global_version ()
SGVector< char * > get_modelsel_names ()
char * get_modsel_param_descr (const char *param_name)
index_t get_modsel_param_index (const char *param_name)

Protected Attributes

E_COMPRESSION_TYPE compression_type

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters
- Protected Member Functions inherited from CSGObject
virtual void load_serializable_pre () throw (ShogunException)
virtual void load_serializable_post () throw (ShogunException)
virtual void save_serializable_pre () throw (ShogunException)
virtual void save_serializable_post () throw (ShogunException)

Constructor & Destructor Documentation

default constructor

Definition at line 38 of file Compressor.cpp.

default constructor

Parameters
ctcompression 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 ( ) const
virtual
Returns
object name

Implements CSGObject.

Definition at line 98 of file Compressor.h.

Member Data Documentation

E_COMPRESSION_TYPE compression_type
protected

compressor type

Definition at line 102 of file Compressor.h.


The documentation for this class was generated from the following files:

SHOGUN Machine Learning Toolbox - Documentation