LZW Compressor
|
Encoder's custom dictionary type. More...
Classes | |
struct | Node |
Binary search tree node. More... | |
Public Member Functions | |
EncoderDictionary () | |
Default constructor. More... | |
void | reset () |
Resets dictionary to its initial contents. More... | |
CodeType | search_and_insert (CodeType i, char c) |
Searches for a pair (i , c ) and inserts the pair if it wasn't found. More... | |
CodeType | search_initials (char c) const |
Fakes a search for byte c in the one-byte area of the dictionary. More... | |
Private Attributes | |
std::vector< Node > | vn |
Vector of nodes on top of which the binary search tree is implemented. | |
std::array< CodeType, 1u<< CHAR_BIT > | initials |
Cheat sheet for mapping one-byte strings to their codes. | |
Encoder's custom dictionary type.
Definition at line 53 of file lzw_v5.cpp.
|
inline |
|
inline |
Resets dictionary to its initial contents.
Definition at line 97 of file lzw_v5.cpp.
References vn.
Referenced by EncoderDictionary(), and search_and_insert().
Searches for a pair (i
, c
) and inserts the pair if it wasn't found.
i | code to search for |
c | attached byte to search for |
globals::dms | if the pair wasn't found |
Definition at line 115 of file lzw_v5.cpp.
References reset(), search_initials(), and vn.
Referenced by compress().
|
inline |
Fakes a search for byte c
in the one-byte area of the dictionary.
c | byte to search for |
Definition at line 166 of file lzw_v5.cpp.
References initials.
Referenced by compress(), and search_and_insert().