Pyrogenesis  trunk
Public Member Functions | List of all members
ICodec Struct Referenceabstract

#include <codec.h>

Inheritance diagram for ICodec:
Inheritance graph
[legend]

Public Member Functions

virtual ~ICodec ()
 note: the implementation should not check whether any data remains - codecs are sometimes destroyed without completing a transfer. More...
 
virtual size_t MaxOutputSize (size_t inSize) const =0
 
virtual Status Reset ()=0
 clear all previous state and prepare for reuse. More...
 
virtual Status Process (const u8 *in, size_t inSize, u8 *out, size_t outSize, size_t &inConsumed, size_t &outProduced)=0
 process (i.e. More...
 
virtual Status Finish (u32 &checksum, size_t &outProduced)=0
 Flush buffers and make sure all output has been produced. More...
 
virtual u32 UpdateChecksum (u32 checksum, const u8 *in, size_t inSize) const =0
 update a checksum to reflect the contents of a buffer. More...
 

Constructor & Destructor Documentation

◆ ~ICodec()

ICodec::~ICodec ( )
virtual

note: the implementation should not check whether any data remains - codecs are sometimes destroyed without completing a transfer.

Member Function Documentation

◆ Finish()

virtual Status ICodec::Finish ( u32 checksum,
size_t &  outProduced 
)
pure virtual

Flush buffers and make sure all output has been produced.

Parameters
checksumChecksum over all input data.
outProduced
Returns
error status for the entire operation.

Implemented in Decompressor_ZLib, Compressor_ZLib, and Codec_ZLibNone.

◆ MaxOutputSize()

virtual size_t ICodec::MaxOutputSize ( size_t  inSize) const
pure virtual
Returns
an upper bound on the output size for the given amount of input. this is used when allocating a single buffer for the whole operation.

Implemented in Decompressor_ZLib, Compressor_ZLib, and Codec_ZLibNone.

◆ Process()

virtual Status ICodec::Process ( const u8 in,
size_t  inSize,
u8 out,
size_t  outSize,
size_t &  inConsumed,
size_t &  outProduced 
)
pure virtual

process (i.e.

compress or decompress) data.

Parameters
in
inSize
out
outSizeBytes remaining in the output buffer; shall not be zero.
inConsumed,outProducedHow many bytes in the input and output buffers were used. either or both of these can be zero if the input size is small or there's not enough output space.

Implemented in Decompressor_ZLib, Compressor_ZLib, and Codec_ZLibNone.

◆ Reset()

virtual Status ICodec::Reset ( )
pure virtual

clear all previous state and prepare for reuse.

this is as if the object were destroyed and re-created, but more efficient since it avoids reallocating a considerable amount of memory (about 200KB for LZ).

Implemented in Decompressor_ZLib, Compressor_ZLib, and Codec_ZLibNone.

◆ UpdateChecksum()

virtual u32 ICodec::UpdateChecksum ( u32  checksum,
const u8 in,
size_t  inSize 
) const
pure virtual

update a checksum to reflect the contents of a buffer.

Parameters
checksumthe initial value (must be 0 on first call)
in
inSize
Returns
the new checksum. note: after all data has been seen, this is identical to the what Finish would return.

Implemented in Codec_ZLib.


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