libfly  6.2.2
C++20 utility library for Linux, macOS, and Windows
fly::coders::HuffmanCode Struct Reference

#include <types.hpp>

Public Member Functions

 HuffmanCode () noexcept
 
 HuffmanCode (symbol_type symbol, code_type code, length_type length) noexcept
 
 HuffmanCode (HuffmanCode &&code) noexcept
 
HuffmanCodeoperator= (HuffmanCode &&code) noexcept
 

Public Attributes

symbol_type m_symbol
 
code_type m_code
 
length_type m_length
 

Friends

bool operator< (const HuffmanCode &left, const HuffmanCode &right)
 

Detailed Description

Struct to store data for a Huffman code.

Author
Timothy Flynn (trfly.nosp@m.nn89.nosp@m.@pm.m.nosp@m.e)
Version
July 7, 2019

Constructor & Destructor Documentation

◆ HuffmanCode() [1/3]

fly::coders::HuffmanCode::HuffmanCode ( )
noexcept

Default constructor. Set all fields to zero.

◆ HuffmanCode() [2/3]

fly::coders::HuffmanCode::HuffmanCode ( symbol_type  symbol,
code_type  code,
length_type  length 
)
noexcept

Constructor.

Parameters
symbolThe symbol from the input stream.
codeThe Huffman code for the symbol.
lengthThe number of bits in the Huffman code.

◆ HuffmanCode() [3/3]

fly::coders::HuffmanCode::HuffmanCode ( HuffmanCode &&  code)
noexcept

Move constructor. Move all member variables from the given HuffmanCode instance into this instance.

Parameters
codeThe HuffmanCode instance to move.

Member Function Documentation

◆ operator=()

HuffmanCode & fly::coders::HuffmanCode::operator= ( HuffmanCode &&  code)
noexcept

Move assignment operator. Move all member variables from the given HuffmanCode instance into this instance.

Parameters
codeThe HuffmanCode instance to move.

Friends And Related Function Documentation

◆ operator<

bool operator< ( const HuffmanCode left,
const HuffmanCode right 
)
friend

Less-than operator. Huffman codes are first compared by code length, then by symbol value.

Parameters
leftThe first Huffman code to compare.
rightThe second Huffman code to compare.
Returns
True if the first Huffman code is less than the second.

The documentation for this struct was generated from the following files: