"L. Spiro Engine"
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

lsi::CLzwDictionary Class Reference

#include <LSILzwDictionary.h>

List of all members.

Classes

struct  LSI_LZW_DICT_ENTRY_DECOMPRESS

Public Types

typedef LSUINT16 LSI_LZW_CODE
typedef struct
lsi::CLzwDictionary::LSI_LZW_DICT_ENTRY_DECOMPRESS
LPLSI_LZW_DICT_ENTRY_DECOMPRESS
typedef struct
lsi::CLzwDictionary::LSI_LZW_DICT_ENTRY_DECOMPRESS 
LPCLSI_LZW_DICT_ENTRY_DECOMPRESS

Public Member Functions

LSVOID LSE_CALL SetAllocator (CAllocator *_paAllocator)
LSBOOL LSE_CALL InitializeDictionary (LSUINT32 _ui32Len, LSUINT32 _ui32MaxBits)
LSBOOL LSE_CALL IsClearCode (LSI_LZW_CODE _lcCode) const
LSBOOL LSE_CALL IsEndOfInputCode (LSI_LZW_CODE _lcCode) const
LSUINT32 LSE_CALL GetTotal () const
LSUINT32 LSE_CALL GetEntryIndex (LSI_LZW_CODE _lcCode) const
LSE_INLINE LSUINT32 LSE_CALL GetBitsNeeded () const
LSVOID LSE_CALL AddCode (LSI_LZW_CODE _lcCode, LSUINT8 _ui8Char)
LSUINT32 LSE_CALL GetString (LSI_LZW_CODE _lcCode, LSUINT8 *_pui8String) const

Static Public Member Functions

static LSUINT32 LSE_CALL GetBits (const LSUINT8 *_pui8Stream, LSUINT64 &_ui64BitIndex, LSUINT32 _ui32Total)

Protected Member Functions

LSBOOL LSE_CALL Alloc (LSUINT32 _ui32Total)
LSVOID LSE_CALL Reset ()
LSUINT32 LSE_CALL DeriveBitsNeeded () const

Protected Attributes

CVectorPoD
< LSI_LZW_DICT_ENTRY_DECOMPRESS,
LSUINT32 > 
m_vDecompDictionary
LSUINT32 m_ui32MaxSize
LSUINT32 m_ui32MaxBits
LSUINT32 m_ui32ClearCode
LSUINT32 m_ui32EndOfInput
LSUINT32 m_ui32BitsNeeded

Detailed Description

Class CLzwDictionary

Description: A dictionary of codes + characters for use with LZW compression and decompression.


Member Typedef Documentation

Decompression uses a smaller dictionary.

A code.


Member Function Documentation

LSVOID LSE_CALL lsi::CLzwDictionary::AddCode ( LSI_LZW_CODE  _lcCode,
LSUINT8  _ui8Char 
)

Add a code during decompression.

Parameters:
_lcCodeThe code to be added.
_ui8CharThe character associated with this code.
LSBOOL LSE_CALL lsi::CLzwDictionary::Alloc ( LSUINT32  _ui32Total) [protected]

Allocate the given amount of entries.

Parameters:
_ui32TotalTotal number of entries to allocate.
Returns:
Returns true if there is enough RAM to complete the operation.
LSUINT32 LSE_CALL lsi::CLzwDictionary::DeriveBitsNeeded ( ) const [protected]

Derive the total number of bits needed to read any code in the dictionary.

Returns:
Returns the number of bits needed to read any code in the dictionary.
static LSUINT32 LSE_CALL lsi::CLzwDictionary::GetBits ( const LSUINT8 *  _pui8Stream,
LSUINT64 &  _ui64BitIndex,
LSUINT32  _ui32Total 
) [static]

Get bits from a stream. _ui64BitIndex is increased by _ui32Total upon return.

Parameters:
_pui8StreamStream of data from which to read the bits.
_ui64BitIndexBit index from which to start reading.
_ui32TotalNumber of bits to get.
Returns:
Returns the read bits as an unsigned 32-bit integer.
LSE_INLINE LSUINT32 LSE_CALL lsi::CLzwDictionary::GetBitsNeeded ( ) const

Get the number of bits needed to access any code.

Returns:
Returns the minimum number of bits needed to access any code in the dictionary.
LSUINT32 LSE_CALL lsi::CLzwDictionary::GetEntryIndex ( LSI_LZW_CODE  _lcCode) const

Get an entry index by its code only. Used when decompressing.

Parameters:
_lcCodeThe code whose index is to be obtained.
Returns:
Returns the index of the code, which is always the code itself.
LSUINT32 LSE_CALL lsi::CLzwDictionary::GetString ( LSI_LZW_CODE  _lcCode,
LSUINT8 *  _pui8String 
) const

Get a string from the dictionary. Translates all codes to characters and returns the length of the string. The string is returned in reverse order.

Parameters:
_lcCodeCode for which to get the string.
_pui8StringHolds the returned string in reverse order.
Returns:
Returns the number of characters in the returned string.
LSUINT32 LSE_CALL lsi::CLzwDictionary::GetTotal ( ) const

Get the size of the dictionary.

Returns:
Returns the number of codes in the dictionary.
LSBOOL LSE_CALL lsi::CLzwDictionary::InitializeDictionary ( LSUINT32  _ui32Len,
LSUINT32  _ui32MaxBits 
)

Set the initial dictionary where each entry is a root.

Parameters:
_ui32LenNumber of codes in the base dictionary. No more than 256.
_ui32MaxBitsMaximum number of bits for any code. since this class only performs decompression, this must always be true.
Returns:
Returns true if there are no memory failures.
LSBOOL LSE_CALL lsi::CLzwDictionary::IsClearCode ( LSI_LZW_CODE  _lcCode) const

Is the given code the clear code?

Parameters:
_lcCodeThe code to be tested against the clear code.
Returns:
Returns true if the code is the clear code.
LSBOOL LSE_CALL lsi::CLzwDictionary::IsEndOfInputCode ( LSI_LZW_CODE  _lcCode) const

Is the given code the end-of-input code?

Parameters:
_lcCodeThe code to be tested against the end-of-input code.
Returns:
Returns true if the code is the end-of-input code.
LSVOID LSE_CALL lsi::CLzwDictionary::Reset ( ) [protected]

Reset everything.

LSVOID LSE_CALL lsi::CLzwDictionary::SetAllocator ( CAllocator *  _paAllocator)

Set the allocator FIRST.

Parameters:
_paAllocatorThe allocator to be used by this object. Must be set before any action on this object takes place.

Member Data Documentation

The number of bits required to read any code in the list.

Clear-code index.

End-of-input index.

LSUINT32 lsi::CLzwDictionary::m_ui32MaxBits [protected]

Maximum bits.

LSUINT32 lsi::CLzwDictionary::m_ui32MaxSize [protected]

Maximum size.

The dictionary array.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator