Internal struct representing nodes of the huffman code tree.
Definition at line 37 of file huffman.cpp.
|
| size_t | frequency |
| | The frequency of the symbol or the sum of the two subtrees.
|
◆ Symbol
Shortcut to the symbol-struct.
Definition at line 40 of file huffman.cpp.
◆ frequency
| size_t alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::frequency |
The frequency of the symbol or the sum of the two subtrees.
Definition at line 69 of file huffman.cpp.
◆ left
| LeftPointer alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::left |
|
protected |
If right is set, then this is a pointer to the left subtree, otherwise a pointer to a symbol.
Definition at line 63 of file huffman.cpp.
◆ right
| Node* alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::right |
|
protected |
◆ Node() [1/2]
| alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::Node |
( |
Symbol * | s | ) |
|
|
inline |
Constructs a node representing a symbol (leaf). Left and right pointers are set to nullptr
- Parameters
-
| s | Pointer to the symbol in symbols, that this node represents. |
Definition at line 77 of file huffman.cpp.
◆ Node() [2/2]
| alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::Node |
( |
Node * | l, |
|
|
Node * | r ) |
|
inline |
Constructs a node as an internal non-leaf node. Left and right pointers are set to as given.
- Parameters
-
| l | Pointer to the left node. |
| r | Pointer to the right node. |
Definition at line 86 of file huffman.cpp.
◆ getLeft()
| Node * alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::getLeft |
( |
| ) |
const |
|
inline |
Must be called only for non-leaf nodes.
- Returns
- The left node.
Definition at line 101 of file huffman.cpp.
◆ getRight()
| Node * alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::getRight |
( |
| ) |
const |
|
inline |
◆ getSymbol()
| Symbol * alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::getSymbol |
( |
| ) |
const |
|
inline |
Must be called only for leaf nodes.
- Returns
- The pointer to the symbol.
Definition at line 97 of file huffman.cpp.
◆ isLeaf()
| bool alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::isLeaf |
( |
| ) |
const |
|
inline |
Determines if this is a leaf node.
- Returns
true if this is a leaf node.
Definition at line 93 of file huffman.cpp.
The documentation for this class was generated from the following file: