KASKADE 7 development version
Loading...
Searching...
No Matches
HuffmanCodec< Symbol > Class Template Reference

A simple Huffman codec with byte-oriented bitstream. More...

#include <prefixcoder.hh>

Public Member Functions

 HuffmanCodec ()=default
template<class Freq>
 HuffmanCodec (Frequencies< Freq, Symbol > const &f)
template<class Freq>
void build (Frequencies< Freq, Symbol > const &f)
template<class OutputByte>
void encode (std::vector< Symbol > const &symbols, std::vector< OutputByte > &out) const
template<class InputByte>
std::vector< Symbol > decode (std::vector< InputByte > const &data, std::size_t symbolCount) const
bool hasSymbol (Symbol s) const
std::unordered_map< Symbol, std::vector< uint8_t > > const & codeTable () const

Detailed Description

template<class Symbol>
class HuffmanCodec< Symbol >

A simple Huffman codec with byte-oriented bitstream.

This implementation avoids fixed-size state limits by emitting bits into a byte stream.

Definition at line 452 of file prefixcoder.hh.

Constructor & Destructor Documentation

◆ HuffmanCodec() [1/2]

template<class Symbol>
HuffmanCodec< Symbol >::HuffmanCodec ( )
default

◆ HuffmanCodec() [2/2]

template<class Symbol>
template<class Freq>
HuffmanCodec< Symbol >::HuffmanCodec ( Frequencies< Freq, Symbol > const & f)
inlineexplicit

Definition at line 458 of file prefixcoder.hh.

Member Function Documentation

◆ build()

template<class Symbol>
template<class Freq>
void HuffmanCodec< Symbol >::build ( Frequencies< Freq, Symbol > const & f)

Referenced by HuffmanCodec().

◆ codeTable()

template<class Symbol>
std::unordered_map< Symbol, std::vector< uint8_t > > const & HuffmanCodec< Symbol >::codeTable ( ) const
inline

Definition at line 477 of file prefixcoder.hh.

◆ decode()

template<class Symbol>
template<class InputByte>
std::vector< Symbol > HuffmanCodec< Symbol >::decode ( std::vector< InputByte > const & data,
std::size_t symbolCount ) const

◆ encode()

template<class Symbol>
template<class OutputByte>
void HuffmanCodec< Symbol >::encode ( std::vector< Symbol > const & symbols,
std::vector< OutputByte > & out ) const

◆ hasSymbol()

template<class Symbol>
bool HuffmanCodec< Symbol >::hasSymbol ( Symbol s) const
inline

Definition at line 472 of file prefixcoder.hh.


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