Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Burger::Compress Class Referenceabstract

Base class for data compression. More...

Inheritance diagram for Burger::Compress:
Collaboration diagram for Burger::Compress:

Public Member Functions

const Burger::StaticRTTIget_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.
 
OutputMemoryStreamGetOutput (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
 

Detailed Description

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.

See also
Burger::Decompress

Constructor & Destructor Documentation

◆ Compress()

Burger::Compress::Compress ( void )

Default constructor.


Initializes the output buffer.

◆ ~Compress()

Burger::Compress::~Compress ( )
virtual

Default destructor.


Releases the output buffer if needed

Member Function Documentation

◆ Finalize()

virtual eError Burger::Compress::Finalize ( void )
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()

Note
This is must be implemented by derived class.
Returns
Zero if no failure, non-zero is an error code
See also
GetOutput() and GetOutputSize()

Implemented in Burger::CompressDeflate, Burger::CompressILBMRLE, and Burger::CompressLZSS.

◆ get_StaticRTTI()

const Burger::StaticRTTI * Burger::Compress::get_StaticRTTI ( void ) const
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.

Returns
Pointer to a global, read only instance of StaticRTTI for the true class

Reimplemented from Burger::Base.

Reimplemented in Burger::CompressDeflate, Burger::CompressILBMRLE, and Burger::CompressLZSS.

◆ GetOutput()

OutputMemoryStream * Burger::Compress::GetOutput ( void )
inlinenoexcept

Get the output data.


After Finalize() has been called, the output data can be obtained with this call

Returns
Pointer to the OutputMemoryStream structure containing the output
See also
Finalize() and GetOutputSize()

◆ GetOutputSize()

uintptr_t Burger::Compress::GetOutputSize ( void ) const
inlinenoexcept

Get the output data size in bytes.


After Finalize() has been called, the output data size can be obtained with this call

Returns
Number of bytes contained in the output stream
See also
Finalize() and GetOutput()

◆ GetSignature()

uint32_t Burger::Compress::GetSignature ( void ) const
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...

AlgorithmCode
LZSS LZSS
ILBM RLE RLE
Inflate (ZLib) ZLIB
LZARI LZAR
RefPack REFP
Huffman HUFF
Returns
A 32 bit number form of the 4 byte character code. It's an endian neutral text string

◆ Init()

virtual eError Burger::Compress::Init ( void )
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.

Note
This is must be implemented by derived class and it also acts as a "reset" function to recycle this class to perform compression on new data.
Returns
Zero if no failure, non-zero is an error code

Implemented in Burger::CompressDeflate, Burger::CompressILBMRLE, and Burger::CompressLZSS.

◆ Process()

virtual eError Burger::Compress::Process ( const void * pInput,
uintptr_t uInputLength )
pure virtual

Compress data.


Pass data into the compressor and store the output into the data stream

Note
This is must be implemented by derived class.
Parameters
pInputPointer to data to compress
uInputLengthNumber of bytes in the data
Returns
Zero if no failure, non-zero is an error code

Implemented in Burger::CompressDeflate, Burger::CompressILBMRLE, and Burger::CompressLZSS.

Member Data Documentation

◆ g_StaticRTTI

const Burger::StaticRTTI Burger::Compress::g_StaticRTTI
static

The global description of the class.


This record contains the name of this class and a reference to the parent

◆ m_Output

OutputMemoryStream Burger::Compress::m_Output
protected

Main output buffer for compressed data.

◆ m_uSignature

uint32_t Burger::Compress::m_uSignature
protected

4 character code to identify this compressor