gem5  v21.0.1.0
Public Member Functions | Private Attributes | List of all members
Compressor::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 70 of file huffman.hh.

Constructor & Destructor Documentation

◆ Node() [1/2]

Compressor::Encoder::Huffman::Node::Node ( uint64_t  value,
uint64_t  frequency 
)
inline

Initialize node as a leaf node.

Definition at line 87 of file huffman.hh.

◆ Node() [2/2]

Compressor::Encoder::Huffman::Node::Node ( Node left,
Node right 
)
inline

Initialize node as an internal node.

Definition at line 93 of file huffman.hh.

Member Function Documentation

◆ getFrequency()

uint64_t Compressor::Encoder::Huffman::Node::getFrequency ( ) const
inline

Getter for the frequency counter.

Definition at line 100 of file huffman.hh.

References _frequency.

Referenced by Compressor::Encoder::Huffman::NodeComparator::operator()().

◆ getLeftSubTree()

const Node* Compressor::Encoder::Huffman::Node::getLeftSubTree ( ) const
inline

Definition at line 126 of file huffman.hh.

References _left.

Referenced by Compressor::Encoder::Huffman::generateCodes().

◆ getRightSubTree()

const Node* Compressor::Encoder::Huffman::Node::getRightSubTree ( ) const
inline

Definition at line 127 of file huffman.hh.

References _right.

Referenced by Compressor::Encoder::Huffman::generateCodes().

◆ getValue()

uint64_t Compressor::Encoder::Huffman::Node::getValue ( ) const
inline

Get the leaf's value.

Returns
The leaf's value.

Definition at line 120 of file huffman.hh.

References _value, and isLeaf().

Referenced by Compressor::Encoder::Huffman::generateCodes().

◆ isLeaf()

bool Compressor::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 109 of file huffman.hh.

References _left, and _right.

Referenced by Compressor::Encoder::Huffman::generateCodes(), and getValue().

Member Data Documentation

◆ _frequency

const uint64_t Compressor::Encoder::Huffman::Node::_frequency
private

Frequency of the value represented by this node.

Definition at line 74 of file huffman.hh.

Referenced by getFrequency().

◆ _left

std::unique_ptr<Node> Compressor::Encoder::Huffman::Node::_left
private

The left tree.

Definition at line 80 of file huffman.hh.

Referenced by getLeftSubTree(), and isLeaf().

◆ _right

std::unique_ptr<Node> Compressor::Encoder::Huffman::Node::_right
private

The right tree.

Definition at line 83 of file huffman.hh.

Referenced by getRightSubTree(), and isLeaf().

◆ _value

const uint64_t Compressor::Encoder::Huffman::Node::_value
private

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

Definition at line 77 of file huffman.hh.

Referenced by getValue().


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

Generated on Tue Jun 22 2021 15:28:50 for gem5 by doxygen 1.8.17