Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __COMPRESSOR_H__
00011 #define __COMPRESSOR_H__
00012
00013 #include <shogun/lib/config.h>
00014 #include <shogun/lib/common.h>
00015 #include <shogun/base/SGObject.h>
00016 #include <shogun/lib/io.h>
00017
00018 #ifdef USE_LZO
00019 #include <lzo/lzoconf.h>
00020 #include <lzo/lzo1x.h>
00021 #endif
00022
00023 namespace shogun
00024 {
00025 enum E_COMPRESSION_TYPE
00026 {
00027 UNCOMPRESSED,
00028 LZO,
00029 GZIP,
00030 BZIP2,
00031 LZMA
00032 };
00033
00034
00047 class CCompressor : public CSGObject
00048 {
00049 public:
00051 CCompressor(void);
00052
00057 CCompressor(E_COMPRESSION_TYPE ct) : CSGObject(), compression_type(ct)
00058 {
00059 }
00060
00062 virtual ~CCompressor()
00063 {
00064 }
00065
00077 void compress(uint8_t* uncompressed, uint64_t uncompressed_size,
00078 uint8_t* &compressed, uint64_t &compressed_size, int32_t level=1);
00079
00092 void decompress(uint8_t* compressed, uint64_t compressed_size,
00093 uint8_t* uncompressed, uint64_t& uncompressed_size);
00094
00096 inline virtual const char* get_name() const { return "Compressor"; }
00097
00098 protected:
00100 E_COMPRESSION_TYPE compression_type;
00101 };
00102 }
00103 #endif //__COMPRESSOR_H__