"L. Spiro Engine"

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

00001 
00026 #ifndef __LSC_LZWENCODINGDICT_H__
00027 #define __LSC_LZWENCODINGDICT_H__
00028 
00029 #include "../LSCCompressionLib.h"
00030 #include "Allocator/LSTLAllocator.h"
00031 
00032 namespace lsc {
00033 
00050         class CLzwEncodingDict {
00051         public :
00052                 // == Various constructors.
00053                 LSE_CALLCTOR                                                    CLzwEncodingDict();
00054                 LSE_CALLCTOR                                                    ~CLzwEncodingDict();
00055 
00056 
00057                 // == Enumerations.
00061                 enum LSN_LZW_INVALID_CODE {
00062                         LSN_LZW_INVALID_CODE                            = ~0UL,
00063                         LSN_LZW_FORCE_DWORD                                     = 0x7FFFFFFFUL,
00064                 };
00065 
00066 
00067                 // == Types.
00071                 typedef struct LSN_LZW_DICT_ENTRY {
00075                         LSUINT32                                                        ui32Code;
00076                         
00080                         LSUINT32                                                        ui32BaseCode;
00081                         
00085                         LSUINT8                                                         ui8Char;
00086                 } * LPLSN_LZW_DICT_ENTRY, * const LPCLSN_LZW_DICT_ENTRY;
00087 
00088 
00089                 // == Functions.
00093                 LSVOID  LSE_CALL                                                Reset();
00094 
00100                 LSVOID LSE_CALL                                                 SetAllocator( CStdAllocator * _psaAllocator );
00101                 
00110                 LSBOOL LSE_CALL                                                 InitDict( LSUINT32 _ui32RootCodes, LSUINT32 _ui32MaxBits );
00111                 
00120                 LSUINT32 LSE_CALL                                               GetEntryIndex( LSUINT32 _ui32Code, LSUINT32 _ui32Char ) const;
00121 
00128                 const LSN_LZW_DICT_ENTRY & LSE_CALL             GetEntry( LSUINT32 _ui32Index ) const;
00129                 
00141                 LSVOID LSE_CALL                                                 AddEntry( LSUINT32 _ui32Index, LSUINT32 _ui32BaseCode, LSUINT32 _ui32Char );
00142 
00148                 LSUINT32 LSE_CALL                                               TotalEntries() const;
00149 
00155                 LSUINT32 LSE_CALL                                               GetMaxDictionarySize() const;
00156 
00164                 LSUINT32 LSE_CALL                                               GetStartingBits() const;
00165 
00171                 LSUINT32 LSE_CALL                                               GetResetCode() const;
00172 
00178                 LSUINT32 LSE_CALL                                               GetEndStreamCode() const;
00179 
00185                 LSUINT32 LSE_CALL                                               GetBits() const;
00186 
00187 
00188         protected :
00189                 // == Members.
00193                 CAllocator                                                              m_caAllocator;
00194                 
00198                 LSUINT32                                                                m_ui32AllocatedDictSize;
00199 
00203                 LSUINT32                                                                m_ui32MaxBits;
00204                 
00208                 LSUINT32                                                                m_ui32DictSize;
00209 
00213                 LSUINT16                                                                m_ui16MinBits;
00214 
00218                 LSUINT16                                                                m_ui16StartingBits;
00219 
00223                 LSUINT32                                                                m_ui32RootCodes;
00224 
00228                 LPLSN_LZW_DICT_ENTRY                                    m_lpldeDictionary;
00229                 
00230         };
00231 
00232 }       // namespace lsc
00233 
00234 #endif  // __LSC_LZWENCODINGDICT_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator