LZW Compressor
|
Variable binary width code writer. More...
Public Member Functions | |
CodeWriter (std::ostream &os) | |
Default constructor. More... | |
~CodeWriter () | |
Destructor. More... | |
std::size_t | get_bits () const |
Getter for CodeWriter::bits . | |
void | reset_bits () |
Resets internal binary width. More... | |
void | increase_bits () |
Increases internal binary width by one. More... | |
bool | write (CodeType k) |
Writes the code k with a binary width of CodeWriter::bits . More... | |
Private Attributes | |
std::ostream & | os |
Output Stream. | |
std::size_t | bits |
Binary width of codes. | |
ByteCache | lo |
LeftOvers. | |
Variable binary width code writer.
Definition at line 219 of file lzw_v6.cpp.
|
inlineexplicit |
Default constructor.
[out] | os | Output Stream to write codes to |
Definition at line 226 of file lzw_v6.cpp.
|
inline |
Destructor.
MetaCode::Eof
and flushes the last byte to the stream. Definition at line 234 of file lzw_v6.cpp.
References ByteCache::data, lo, os, ByteCache::used, and write().
|
inline |
Increases internal binary width by one.
std::overflow_error | internal binary width cannot be increased |
Definition at line 265 of file lzw_v6.cpp.
References bits.
Referenced by compress().
|
inline |
Resets internal binary width.
CHAR_BIT + 1
. Definition at line 255 of file lzw_v6.cpp.
References bits.
Referenced by compress().
|
inline |
Writes the code k
with a binary width of CodeWriter::bits
.
k | code to be written |
true | the output stream can still be used |
false | the output stream can no longer be used |
Definition at line 281 of file lzw_v6.cpp.
References bits, ByteCache::data, lo, os, and ByteCache::used.
Referenced by compress(), and ~CodeWriter().