tudocomp
– The TU Dortmund Compression Framework
tdc::lz78::LZ78Trie< _node_t > Class Template Reference

#include <LZ78Trie.hpp>

Public Types

using node_t = _node_t
 

Protected Member Functions

 LZ78Trie (const size_t n, const size_t &remaining_characters)
 
size_t expected_number_of_remaining_elements (const size_t z) const
 
node_t add_rootnode (uliteral_t c)
 The dictionary can store multiple root nodes For LZ78, we use a root node with the id = c = 0. More...
 
node_t get_rootnode (uliteral_t c) const
 Returns the root node corresponding to literal c. More...
 
void clear ()
 Erases the contents of the dictionary. More...
 
node_t find_or_insert (const node_t &parent, uliteral_t c)
 Searches a pair (parent, c). More...
 
size_t size () const
 Returns the number of entries, plus the number of rootnodes. More...
 

Detailed Description

template<typename _node_t = LZ78TrieNode>
class tdc::lz78::LZ78Trie< _node_t >

Definition at line 41 of file LZ78Trie.hpp.

Member Typedef Documentation

◆ node_t

template<typename _node_t = LZ78TrieNode>
using tdc::lz78::LZ78Trie< _node_t >::node_t = _node_t

Definition at line 43 of file LZ78Trie.hpp.

Constructor & Destructor Documentation

◆ LZ78Trie()

template<typename _node_t = LZ78TrieNode>
tdc::lz78::LZ78Trie< _node_t >::LZ78Trie ( const size_t  n,
const size_t &  remaining_characters 
)
inlineprotected

Definition at line 48 of file LZ78Trie.hpp.

Member Function Documentation

◆ add_rootnode()

template<typename _node_t = LZ78TrieNode>
node_t tdc::lz78::LZ78Trie< _node_t >::add_rootnode ( uliteral_t  c)
inlineprotected

The dictionary can store multiple root nodes For LZ78, we use a root node with the id = c = 0.

For LZW, we add for each possible literal value a root node. The compressor has to add these nodes.

Definition at line 61 of file LZ78Trie.hpp.

◆ clear()

template<typename _node_t = LZ78TrieNode>
void tdc::lz78::LZ78Trie< _node_t >::clear ( )
inlineprotected

Erases the contents of the dictionary.

Used by compressors with limited dictionary size.

Definition at line 78 of file LZ78Trie.hpp.

◆ expected_number_of_remaining_elements()

template<typename _node_t = LZ78TrieNode>
size_t tdc::lz78::LZ78Trie< _node_t >::expected_number_of_remaining_elements ( const size_t  z) const
inlineprotected

Definition at line 51 of file LZ78Trie.hpp.

◆ find_or_insert()

template<typename _node_t = LZ78TrieNode>
node_t tdc::lz78::LZ78Trie< _node_t >::find_or_insert ( const node_t parent,
uliteral_t  c 
)
inlineprotected

Searches a pair (parent, c).

If there is no node below parent on an edge labeled with c, a new leaf of the parent will be constructed.

Parameters
parentthe parent node's id
cthe edge label to follow
Returns
the new or found child node

Definition at line 87 of file LZ78Trie.hpp.

◆ get_rootnode()

template<typename _node_t = LZ78TrieNode>
node_t tdc::lz78::LZ78Trie< _node_t >::get_rootnode ( uliteral_t  c) const
inlineprotected

Returns the root node corresponding to literal c.

Definition at line 69 of file LZ78Trie.hpp.

◆ size()

template<typename _node_t = LZ78TrieNode>
size_t tdc::lz78::LZ78Trie< _node_t >::size ( ) const
inlineprotected

Returns the number of entries, plus the number of rootnodes.

Definition at line 95 of file LZ78Trie.hpp.


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