Project
Loading...
Searching...
No Matches
o2::data_compression::HuffmanCodec< _CodingModel > Class Template Reference

Main class of the Huffman codec implementation. More...

#include <HuffmanCodec.h>

Public Types

using model_type = _CodingModel
 
using value_type = typename model_type::value_type
 
using code_type = typename model_type::code_type
 

Public Member Functions

 HuffmanCodec ()=delete
 
 HuffmanCodec (const model_type &model)
 
 ~HuffmanCodec ()=default
 
template<typename ValueType >
const bool Encode (ValueType v, code_type &code, uint16_t &codeLength) const
 
template<typename ReturnType >
bool Decode (ReturnType &v, code_type code, uint16_t &codeLength) const
 
model_type const & getCodingModel () const
 Get the underlying coding model.
 
int loadConfiguration (const char *filename, std::string method="zlib")
 
int writeConfiguration (const char *filename, std::string method="zlib") const
 

Detailed Description

template<typename _CodingModel>
class o2::data_compression::HuffmanCodec< _CodingModel >

Main class of the Huffman codec implementation.

The codec forwards the encoding/decoding requests to the implementation of the coding model.

TODO:

  • Multi parameter support
  • Interface methods to methods of the instances of the coding model

Definition at line 164 of file HuffmanCodec.h.

Member Typedef Documentation

◆ code_type

template<typename _CodingModel >
using o2::data_compression::HuffmanCodec< _CodingModel >::code_type = typename model_type::code_type

Definition at line 169 of file HuffmanCodec.h.

◆ model_type

template<typename _CodingModel >
using o2::data_compression::HuffmanCodec< _CodingModel >::model_type = _CodingModel

Definition at line 167 of file HuffmanCodec.h.

◆ value_type

template<typename _CodingModel >
using o2::data_compression::HuffmanCodec< _CodingModel >::value_type = typename model_type::value_type

Definition at line 168 of file HuffmanCodec.h.

Constructor & Destructor Documentation

◆ HuffmanCodec() [1/2]

template<typename _CodingModel >
o2::data_compression::HuffmanCodec< _CodingModel >::HuffmanCodec ( )
delete

◆ HuffmanCodec() [2/2]

template<typename _CodingModel >
o2::data_compression::HuffmanCodec< _CodingModel >::HuffmanCodec ( const model_type model)
inline

Definition at line 172 of file HuffmanCodec.h.

◆ ~HuffmanCodec()

template<typename _CodingModel >
o2::data_compression::HuffmanCodec< _CodingModel >::~HuffmanCodec ( )
default

Member Function Documentation

◆ Decode()

template<typename _CodingModel >
template<typename ReturnType >
bool o2::data_compression::HuffmanCodec< _CodingModel >::Decode ( ReturnType &  v,
code_type  code,
uint16_t &  codeLength 
) const
inline

Decode a value

Parameters
v[out] decoded value
code[in] code to be processed
codeLength[out] length of the processed code

Definition at line 191 of file HuffmanCodec.h.

◆ Encode()

template<typename _CodingModel >
template<typename ValueType >
const bool o2::data_compression::HuffmanCodec< _CodingModel >::Encode ( ValueType  v,
code_type code,
uint16_t &  codeLength 
) const
inline

Encode a value and return Huffman code and code lenght

Parameters
vvalue to be encoded
code[out] returned code
codeLength[out] length of the returned code

Definition at line 180 of file HuffmanCodec.h.

◆ getCodingModel()

template<typename _CodingModel >
model_type const & o2::data_compression::HuffmanCodec< _CodingModel >::getCodingModel ( ) const
inline

Get the underlying coding model.

Definition at line 198 of file HuffmanCodec.h.

◆ loadConfiguration()

template<typename _CodingModel >
int o2::data_compression::HuffmanCodec< _CodingModel >::loadConfiguration ( const char filename,
std::string  method = "zlib" 
)
inline

Load configuration from file

Text file can be in compressed format, supported methods: gzip, zlib, bzip2, and lzma

Definition at line 206 of file HuffmanCodec.h.

◆ writeConfiguration()

template<typename _CodingModel >
int o2::data_compression::HuffmanCodec< _CodingModel >::writeConfiguration ( const char filename,
std::string  method = "zlib" 
) const
inline

Write configuration to file

Can be written in compressed format, supported methods: gzip, zlib, bzip2, and lzma

Definition at line 214 of file HuffmanCodec.h.


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