ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node Class Reference

Description:

Internal struct representing nodes of the huffman code tree.

Definition at line 37 of file huffman.cpp.

Inner Type Index:

union  LeftPointer

Public Field Index:

size_t frequency
 The frequency of the symbol or the sum of the two subtrees.

Public Method Index:

 Node ()=default
 Default constructor used when defining arrays of nodes on stack memory.
 Node (Node *l, Node *r)
 Node (Symbol *s)
NodegetLeft () const
NodegetRight () const
SymbolgetSymbol () const
bool isLeaf () const

Protected Field Index:

LeftPointer left
Noderight
 The right subtree.

Private Type Index:

using Symbol = HuffmanEncoder::Symbol
 Shortcut to the symbol-struct.

Type Definition Details:

◆ Symbol

using alib::bitbuffer::ac_v1::anonymous_namespace{huffman.cpp}::Node::Symbol = HuffmanEncoder::Symbol
private

Shortcut to the symbol-struct.

Definition at line 40 of file huffman.cpp.

Field Details:

◆ 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

The right subtree.

Definition at line 65 of file huffman.cpp.

Constructor(s) / Destructor Details:

◆ 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
sPointer 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
lPointer to the left node.
rPointer to the right node.

Definition at line 86 of file huffman.cpp.

Method Details:

◆ 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
Returns
The right node.

Definition at line 104 of file huffman.cpp.

◆ 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: