Base class for data compression. More...
Public Member Functions | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
Compress (void) | |
Default constructor. | |
virtual | ~Compress () |
Default destructor. | |
virtual eError | Init (void)=0 |
Initialize the compression algorithm. | |
virtual eError | Process (const void *pInput, uintptr_t uInputLength)=0 |
Compress data. | |
virtual eError | Finalize (void)=0 |
Finish the compression. | |
OutputMemoryStream * | GetOutput (void) noexcept |
Get the output data. | |
uintptr_t | GetOutputSize (void) const noexcept |
Get the output data size in bytes. | |
uint32_t | GetSignature (void) const noexcept |
Return the signature for this compressor. | |
Public Member Functions inherited from Burger::Base | |
const char * | get_class_name (void) const noexcept |
Get the name of the class. | |
virtual | ~Base () noexcept=default |
Destructor. | |
Static Public Attributes | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Static Public Attributes inherited from Burger::Base | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Protected Attributes | |
OutputMemoryStream | m_Output |
Main output buffer for compressed data. | |
uint32_t | m_uSignature |
4 character code to identify this compressor | |
Base class for data compression.
For functions that allow compression, this class will allow any compression algorithm to be used as long as they derive from this base class.
The only data present is an OutputMemoryStream that will contain the compressed data stream and will be valid once the Compress::Finalize() function is called.
Burger::Compress::Compress | ( | void | ) |
Default constructor.
Initializes the output buffer.
|
virtual |
Default destructor.
Releases the output buffer if needed
|
pure virtual |
Finish the compression.
Perform the final data compaction and clean up. After this call is performed, the output is valid and can be accessed with calls to GetOutput() and GetOutputSize()
Implemented in Burger::CompressDeflate, Burger::CompressILBMRLE, and Burger::CompressLZSS.
|
overridevirtualnoexcept |
Get the description to the class.
This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.
Reimplemented from Burger::Base.
Reimplemented in Burger::CompressDeflate, Burger::CompressILBMRLE, and Burger::CompressLZSS.
|
inlinenoexcept |
Get the output data.
After Finalize() has been called, the output data can be obtained with this call
|
inlinenoexcept |
Get the output data size in bytes.
After Finalize() has been called, the output data size can be obtained with this call
|
inlinenoexcept |
Return the signature for this compressor.
Each compressor has a unique signature to identify the algorithm used for compression. It's in the form of a 4 character code.
Popular codes are...
Algorithm | Code |
---|---|
LZSS | LZSS |
ILBM RLE | RLE |
Inflate (ZLib) | ZLIB |
LZARI | LZAR |
RefPack | REFP |
Huffman | HUFF |
|
pure virtual |
Initialize the compression algorithm.
This function will reset the compression algorithm (Which may or may not require memory allocations) and returns an error code if there was a failure.
Implemented in Burger::CompressDeflate, Burger::CompressILBMRLE, and Burger::CompressLZSS.
|
pure virtual |
Compress data.
Pass data into the compressor and store the output into the data stream
pInput | Pointer to data to compress |
uInputLength | Number of bytes in the data |
Implemented in Burger::CompressDeflate, Burger::CompressILBMRLE, and Burger::CompressLZSS.
|
static |
The global description of the class.
This record contains the name of this class and a reference to the parent
|
protected |
Main output buffer for compressed data.
|
protected |
4 character code to identify this compressor