![]() |
mksqlite
2.5
A MATLAB interface to SQLite
|
compressor class More...
#include <number_compressor.hpp>
Public Types | |
enum | compressor_type_e { CT_NONE = 0, CT_BLOSC, CT_QLIN16, CT_QLOG16 } |
supported compressor types More... | |
Public Member Functions | |
NumberCompressor () | |
Ctor. | |
void | free_result () |
Clear self created results with memory deallocation. | |
void | clear_data () |
Reset input data (compressed and uncompressed) memory without deallocation! | |
void | clear_err () |
Reset recent error message. | |
int | get_err () |
Get recent error message id. | |
~NumberCompressor () | |
Dtor. | |
void | setAllocator (void *(*Allocator)(size_t), void(*DeAllocator)(void *)) |
Set memory management. More... | |
bool | setCompressor (const char *strCompressorType, int iCompressionLevel=-1) |
Converts compressor ID string to category enum. More... | |
const char * | getCompressorName () |
Get compressor name. | |
bool | isLossy () |
Returns true, if current compressor modifies value data. | |
bool | pack (void *rdata, size_t rdata_size, size_t rdata_element_size, bool isDoubleClass) |
Calls the qualified compressor (deflate) which always allocates sufficient memory (m_cdata) More... | |
bool | unpack (void *cdata, size_t cdata_size, void *rdata, size_t rdata_size, size_t rdata_element_size) |
Calls the qualified compressor (inflate) More... | |
Public Attributes | |
bool | m_result_is_const |
true, if result is const type | |
void * | m_result |
compressor output | |
size_t | m_result_size |
size of compressor output in bytes | |
void * | m_rdata |
uncompressed data | |
size_t | m_rdata_size |
size of uncompressed data in bytes | |
size_t | m_rdata_element_size |
size of one element in bytes | |
bool | m_rdata_is_double_type |
Flag type is mxDOUBLE_CLASS. | |
void * | m_cdata |
compressed data | |
size_t | m_cdata_size |
size of compressed data in bytes | |
Private Member Functions | |
bool | bloscCompress () |
Allocates memory for compressed data and use it to store results (lossless data compression) More... | |
bool | bloscDecompress () |
Uncompress compressed data m_cdata to data m_rdata. More... | |
bool | linlogQuantizerCompress (bool bDoLog) |
Lossy data compression by linear or logarithmic quantization (16 bit) More... | |
bool | linlogQuantizerDecompress (bool bDoLog) |
NumberCompressor (const NumberCompressor &) | |
NumberCompressor & | operator= (const NumberCompressor &) |
Private Attributes | |
Err | m_err |
recent error | |
const char * | m_strCompressorType |
name of compressor to use | |
compressor_type_e | m_eCompressorType |
enum type of compressor to use | |
int | m_iCompressionLevel |
compression level (0 to 9) | |
void *(* | m_Allocator )(size_t szBytes) |
memory allocator | |
void(* | m_DeAllocator )(void *ptr) |
memory deallocator | |
compressor class
Definition at line 53 of file number_compressor.hpp.
supported compressor types
Enumerator | |
---|---|
CT_NONE | no compression |
CT_BLOSC | using BLOSC compressor (lossless) |
CT_QLIN16 | using linear quantization (lossy) |
CT_QLOG16 | using logarithmic quantization (lossy) |
Definition at line 57 of file number_compressor.hpp.
|
private |
inhibit copy constructor and assignment operator
|
inlineprivate |
Allocates memory for compressed data and use it to store results (lossless data compression)
Definition at line 367 of file number_compressor.hpp.
References m_Allocator, and Err::set().
Referenced by pack().
|
inlineprivate |
Uncompress compressed data m_cdata
to data
m_rdata.
m_rdata
must point to writable storage space and m_rdata_size
must specify the legal space.
Definition at line 404 of file number_compressor.hpp.
References Err::set().
Referenced by unpack().
|
inlineprivate |
Lossy data compression by linear or logarithmic quantization (16 bit)
Allocates m_cdata
and use it to store compressed data from m_rdata
. Only double types accepted! NaN, +Inf and -Inf are allowed.
[in] | bDoLog | Using logarithmic (true) or linear (false) quantization. |
Definition at line 439 of file number_compressor.hpp.
References Err::set().
Referenced by pack().
|
inlineprivate |
[in] | bDoLog | Using logarithmic (true) or linear (false) quantization. |
Uncompress compressed data m_cdata
to data m_rdata
. m_rdata
must point to writable storage space and m_rdata_size
must specify the legal space. (lossy data compression)
Definition at line 570 of file number_compressor.hpp.
References Err::set().
Referenced by unpack().
|
inline |
Calls the qualified compressor (deflate) which always allocates sufficient memory (m_cdata)
[in] | rdata | pointer to raw data (byte stream) |
[in] | rdata_size | length of raw data in bytes |
[in] | rdata_element_size | size of one element in bytes |
[in] | isDoubleClass | true, if elements represent double types |
deploy result (compressed data)
Definition at line 264 of file number_compressor.hpp.
References bloscCompress(), clear_data(), clear_err(), CT_BLOSC, CT_QLIN16, CT_QLOG16, free_result(), linlogQuantizerCompress(), m_cdata, and m_cdata_size.
|
inline |
Set memory management.
[in] | Allocator | memory allocating functor |
[in] | DeAllocator | memory deallocating functor |
Definition at line 163 of file number_compressor.hpp.
References m_Allocator, and m_DeAllocator.
|
inline |
Converts compressor ID string to category enum.
[in] | strCompressorType | Compressor name as string |
[in] | iCompressionLevel | Compression level (compressor dependent) |
Definition at line 183 of file number_compressor.hpp.
References Err::clear(), COMPRESSOR_DEFAULT_ID, and CT_NONE.
Referenced by NumberCompressor().
|
inline |
Calls the qualified compressor (inflate)
[in] | cdata | pointer to compressed data |
[in] | cdata_size | length of compressed data in bytes |
[in,out] | rdata | pointer to memory for decompressed data |
[out] | rdata_size | available space ar rdata in bytes |
[in] | rdata_element_size | size of one element in decompressed vector |
acquire compressed data
dispatch
deplay result (uncompressed/raw data)
Definition at line 316 of file number_compressor.hpp.
References bloscDecompress(), clear_data(), clear_err(), CT_BLOSC, CT_QLIN16, CT_QLOG16, free_result(), linlogQuantizerDecompress(), m_rdata, and m_rdata_size.