gem5  v22.0.0.2
Public Member Functions | Private Attributes | List of all members
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. More...
 
 Node (Node *left, Node *right)
 Initialize node as an internal node. More...
 
uint64_t getFrequency () const
 Getter for the frequency counter. More...
 
bool isLeaf () const
 Determine if the node is a leaf node by checking if it does not have sub-trees. More...
 
uint64_t getValue () const
 Get the leaf's value. More...
 
const NodegetLeftSubTree () const
 
const NodegetRightSubTree () const
 

Private Attributes

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

Detailed Description

Node for the Huffman tree.

Definition at line 78 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 95 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 101 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 108 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 134 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 135 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 128 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 117 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 82 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 88 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 91 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 85 of file huffman.hh.

Referenced by getValue().


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

Generated on Thu Jul 28 2022 13:33:28 for gem5 by doxygen 1.8.17