"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSCompressionLib/Src/LZW/LSCLzwDecodingDict.h

00001 
00019 #ifndef __LSC_LZWDECODINGDICT_H__
00020 #define __LSC_LZWDECODINGDICT_H__
00021 
00022 #include "../LSCCompressionLib.h"
00023 #include "String/LSTLString.h"
00024 
00025 namespace lsc {
00026 
00036         class CLzwDecodingDict {
00037         public :
00038                 // == Various constructors.
00039                 LSE_CALLCTOR                                                    CLzwDecodingDict();
00040                 LSE_CALLCTOR                                                    ~CLzwDecodingDict();
00041 
00042 
00043                 // == Types.
00047                 typedef LSUINT32                                                LSN_LZW_CODE;
00048 
00052                 typedef struct LSN_LZW_DICT_ENTRY {
00053                         // The code on which this is based.
00054                         LSUINT32                                                        ui32BaseCode    : 24;
00055                         
00056                         // The character appended to the base code which creates this entry.
00057                         LSUINT32                                                        ui8Char                 : 8;
00058                 } * LPLSN_LZW_DICT_ENTRY, * const LPCLSN_LZW_DICT_ENTRY;
00059 
00060 
00061                 // == Functions.
00065                 LSVOID  LSE_CALL                                                Reset();
00066 
00072                 LSVOID LSE_CALL                                                 SetAllocator( CStdAllocator * _psaAllocator );
00073 
00080                 LSVOID LSE_CALL                                                 InitializeDictionary( LSUINT32 _ui32Len, LSUINT32 _ui32MaxBits );
00081 
00088                 LSBOOL LSE_CALL                                                 IsClearCode( LSN_LZW_CODE _lcCode ) const;
00089                 
00096                 LSBOOL LSE_CALL                                                 IsEndOfInputCode( LSN_LZW_CODE _lcCode ) const;
00097 
00103                 LSUINT32 LSE_CALL                                               GetTotal() const;
00104 
00111                 LSBOOL LSE_CALL                                                 AddCode( LSN_LZW_CODE _lcCode, LSUINT8 _ui8Char );
00112 
00122                 LSBOOL LSE_CALL                                                 GetString( LSN_LZW_CODE _lcCode, CString &_sString ) const;
00123 
00129                 LSE_INLINE LSUINT32 LSE_CALL                    GetBitsNeeded() const;
00130 
00131 
00132         protected :
00133                 // == Members.
00137                 CAllocator                                                              m_aAllocator;
00138 
00142                 LPLSN_LZW_DICT_ENTRY                                    m_lpldeDictionary;
00143 
00147                 LSUINT32                                                                m_ui32Total,
00148                                                                                                 m_ui32Alloc;
00149 
00153                 LSUINT32                                                                m_ui32RootLen;
00154 
00158                 LSUINT32                                                                m_ui32MaxSize;
00159 
00163                 LSUINT32                                                                m_ui32MaxBits;
00164 
00168                 LSUINT32                                                                m_ui32BitsNeeded;
00169 
00170 
00171                 // == Functions.
00177                 LSBOOL LSE_CALL                                                 Alloc();
00178 
00185                 LSUINT32 LSE_CALL                                               DeriveBitsNeeded() const;
00186         };
00187 
00188 
00189         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00190         // DEFINITIONS
00191         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00192         // == Functions.
00198         LSE_INLINE LSUINT32 LSE_CALL CLzwDecodingDict::GetBitsNeeded() const {
00199                 return m_ui32BitsNeeded;
00200         }
00201 
00202 }       // namespace lsc
00203 
00204 #endif  // __LSC_LZWDECODINGDICT_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator