gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::compression::encoder::Huffman::Node Class Reference

Node for the Huffman tree. More...

Public Member Functions

 Node (uint64_t value, uint64_t frequency)
 Initialize node as a leaf node.
 
 Node (Node *left, Node *right)
 Initialize node as an internal node.
 
uint64_t getFrequency () const
 Getter for the frequency counter.
 
bool isLeaf () const
 Determine if the node is a leaf node by checking if it does not have sub-trees.
 
uint64_t getValue () const
 Get the leaf's value.
 
const NodegetLeftSubTree () const
 
const NodegetRightSubTree () const
 

Private Attributes

const uint64_t _frequency
 Frequency of the value represented by this node.
 
const uint64_t _value
 Value represented by this node, if this is a leaf node.
 
std::unique_ptr< Node_left
 The left tree.
 
std::unique_ptr< Node_right
 The right tree.
 

Detailed Description

Node for the Huffman tree.

Definition at line 76 of file huffman.hh.

Constructor & Destructor Documentation

◆ Node() [1/2]

gem5::compression::encoder::Huffman::Node::Node ( uint64_t value,
uint64_t frequency )
inline

Initialize node as a leaf node.

Definition at line 93 of file huffman.hh.

◆ Node() [2/2]

gem5::compression::encoder::Huffman::Node::Node ( Node * left,
Node * right )
inline

Initialize node as an internal node.

Definition at line 99 of file huffman.hh.

Member Function Documentation

◆ getFrequency()

uint64_t gem5::compression::encoder::Huffman::Node::getFrequency ( ) const
inline

Getter for the frequency counter.

Definition at line 106 of file huffman.hh.

References _frequency.

Referenced by gem5::compression::encoder::Huffman::NodeComparator::operator()().

◆ getLeftSubTree()

const Node * gem5::compression::encoder::Huffman::Node::getLeftSubTree ( ) const
inline

Definition at line 132 of file huffman.hh.

References _left.

Referenced by gem5::compression::encoder::Huffman::generateCodes().

◆ getRightSubTree()

const Node * gem5::compression::encoder::Huffman::Node::getRightSubTree ( ) const
inline

Definition at line 133 of file huffman.hh.

References _right.

Referenced by gem5::compression::encoder::Huffman::generateCodes().

◆ getValue()

uint64_t gem5::compression::encoder::Huffman::Node::getValue ( ) const
inline

Get the leaf's value.

Returns
The leaf's value.

Definition at line 126 of file huffman.hh.

References _value, and isLeaf().

Referenced by gem5::compression::encoder::Huffman::generateCodes().

◆ isLeaf()

bool gem5::compression::encoder::Huffman::Node::isLeaf ( ) const
inline

Determine if the node is a leaf node by checking if it does not have sub-trees.

Returns
Wether the node is a leaf node.

Definition at line 115 of file huffman.hh.

References _left, and _right.

Referenced by gem5::compression::encoder::Huffman::generateCodes(), and getValue().

Member Data Documentation

◆ _frequency

const uint64_t gem5::compression::encoder::Huffman::Node::_frequency
private

Frequency of the value represented by this node.

Definition at line 80 of file huffman.hh.

Referenced by getFrequency().

◆ _left

std::unique_ptr<Node> gem5::compression::encoder::Huffman::Node::_left
private

The left tree.

Definition at line 86 of file huffman.hh.

Referenced by getLeftSubTree(), and isLeaf().

◆ _right

std::unique_ptr<Node> gem5::compression::encoder::Huffman::Node::_right
private

The right tree.

Definition at line 89 of file huffman.hh.

Referenced by getRightSubTree(), and isLeaf().

◆ _value

const uint64_t gem5::compression::encoder::Huffman::Node::_value
private

Value represented by this node, if this is a leaf node.

Definition at line 83 of file huffman.hh.

Referenced by getValue().


The documentation for this class was generated from the following file:

Generated on Tue Jun 18 2024 16:24:19 for gem5 by doxygen 1.11.0