Tree Compression with Top Trees Revisited
|
Generic Huffman Code Builder. Only constructs code, does not en-/decode. More...
#include <Huffman.h>
Public Types | |
typedef std::vector< bool > | HuffCode |
Public Member Functions | |
HuffmanBuilder () | |
void | addItem (const SymbolType &symbol) |
add an occurence to the frequency statistics More... | |
template<class InputIterator > | |
void | addItems (InputIterator begin, InputIterator end) |
add a sequence of occurences to the frequency statistics More... | |
void | construct () |
Construct a Huffman code for the symols encountered, and the frequencies with which they were encountered. More... | |
int | getNumSymbols () const |
Get the number of different symbols encountered. More... | |
int | getNumItems () const |
Get the total number of occurences encountered. More... | |
HuffCode | getCode (const SymbolType &symbol) |
Get the code for a symbol. Must to have called construct() before. More... | |
int | getCodeLength (const SymbolType &symbol) const |
Get the length of a symbol's code. Need to have called construct() before. More... | |
long long | getBitsNeeded () const |
long long | getBitsForTree () const |
long long | getBitsForTableLabels () const |
std::string | toString () const |
Protected Member Functions | |
void | constructTree () |
Construct a Huffman tree from the symbols encountered and the frequencies observed. More... | |
void | computeCodes (const int nodeId, HuffCode prefix) |
Recursively assign codes to the symbols. More... | |
Protected Attributes | |
int | numItems |
std::unordered_map< SymbolType, int > | symbols |
std::vector< int > | frequencies |
std::vector< HuffCode > | codes |
std::vector< HuffNode * > | nodes |
Friends | |
std::ostream & | operator<< (std::ostream &os, const HuffmanBuilder &huff) |
Print summary to an ostream. More... | |
Generic Huffman Code Builder. Only constructs code, does not en-/decode.
typedef std::vector<bool> HuffmanBuilder< SymbolType >::HuffCode |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inline |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
Get the number of bits needed to encode the occurrences encountered with the code that was calculated (need to have called construct() before).
|
inline |
Get the code for a symbol. Must to have called construct() before.
|
inline |
Get the length of a symbol's code. Need to have called construct() before.
|
inline |
|
inline |
|
inline |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |