|
libfly
6.2.2
C++20 utility library for Linux, macOS, and Windows
|
#include <types.hpp>

Public Member Functions | |
| HuffmanNode () noexcept | |
| HuffmanNode & | operator= (HuffmanNode &&node) noexcept |
| void | become_symbol (symbol_type symbol, frequency_type frequency) |
| void | become_intermediate (HuffmanNode *left, HuffmanNode *right) |
Public Attributes | |
| symbol_type | m_symbol |
| frequency_type | m_frequency |
| HuffmanNode * | m_left |
| HuffmanNode * | m_right |
Struct to store data for a single node in a Huffman tree. Huffman trees are binary trees. A node represents either a symbol from the input stream and its frequency, or the node is a junction storing the sum total of the frequencies of each node in its subtree.
|
noexcept |
Default constructor. Set all fields to zero/null.
| void fly::coders::HuffmanNode::become_intermediate | ( | HuffmanNode * | left, |
| HuffmanNode * | right | ||
| ) |
Change this node to represent an intermediate, non-symbol. Its frequency is set to the sum of its children's frequencies.
| left | Pointer to the intermediate's left child. |
| right | Pointer to the intermediate's right child. |
| void fly::coders::HuffmanNode::become_symbol | ( | symbol_type | symbol, |
| frequency_type | frequency | ||
| ) |
Change this node to represent a symbol from the input stream.
| symbol | The symbol from the input stream. |
| frequency | The frequency of the symbol in the input stream. |
|
noexcept |
Move assignment operator. Move all member variables from the given HuffmanNode instance into this instance.
| node | The HuffmanNode instance to move. |