tudocomp
– The TU Dortmund Compression Framework
tdc::lz78::TernaryTrie Class Reference

LZ78 Trie Implementation based on Julius Pettersson (MIT/Expat License.) and Juha Nieminen's work. More...

#include <TernaryTrie.hpp>

Inheritance diagram for tdc::lz78::TernaryTrie:
tdc::Algorithm tdc::lz78::LZ78Trie<>

Public Member Functions

 TernaryTrie (Env &&env, const size_t n, const size_t &remaining_characters, factorid_t reserve=0)
 
 IF_STATS (size_t m_resizes=0;size_t m_specialresizes=0;) IF_STATS(MoveGuard m_guard
 
 ~TernaryTrie ()
 
 TernaryTrie (TernaryTrie &&other)=default
 
TernaryTrie & operator= (TernaryTrie &&other)=default
 
node_t add_rootnode (uliteral_t c)
 
node_t get_rootnode (uliteral_t c) const
 
void clear ()
 
node_t find_or_insert (const node_t &parent_w, uliteral_t c)
 
size_t size () const
 
- Public Member Functions inherited from tdc::Algorithm
virtual ~Algorithm ()=default
 
 Algorithm (Algorithm const &)=default
 
 Algorithm (Algorithm &&)=default
 
Algorithm & operator= (Algorithm const &)=default
 
Algorithm & operator= (Algorithm &&)=default
 
 Algorithm (Env &&env)
 Instantiates an algorithm in the specified environment. More...
 
Env & env ()
 Provides access to the environment that the algorithm works in. More...
 
const Env & env () const
 

Static Public Member Functions

static Meta meta ()
 

Additional Inherited Members

- Public Types inherited from tdc::lz78::LZ78Trie<>
using node_t = LZ78TrieNode
 
- Protected Member Functions inherited from tdc::lz78::LZ78Trie<>
 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

LZ78 Trie Implementation based on Julius Pettersson (MIT/Expat License.) and Juha Nieminen's work.

See also
http://www.cplusplus.com/articles/iL18T05o/

Definition at line 16 of file TernaryTrie.hpp.

Constructor & Destructor Documentation

◆ TernaryTrie() [1/2]

tdc::lz78::TernaryTrie::TernaryTrie ( Env &&  env,
const size_t  n,
const size_t &  remaining_characters,
factorid_t  reserve = 0 
)
inline

Definition at line 34 of file TernaryTrie.hpp.

◆ ~TernaryTrie()

tdc::lz78::TernaryTrie::~TernaryTrie ( )
inline

Definition at line 53 of file TernaryTrie.hpp.

◆ TernaryTrie() [2/2]

tdc::lz78::TernaryTrie::TernaryTrie ( TernaryTrie &&  other)
default

Member Function Documentation

◆ add_rootnode()

node_t tdc::lz78::TernaryTrie::add_rootnode ( uliteral_t  c)
inline

Definition at line 65 of file TernaryTrie.hpp.

◆ clear()

void tdc::lz78::TernaryTrie::clear ( )
inline

Definition at line 78 of file TernaryTrie.hpp.

◆ find_or_insert()

node_t tdc::lz78::TernaryTrie::find_or_insert ( const node_t &  parent_w,
uliteral_t  c 
)
inline

if we add a new node, its index will be equal to the current size of the dictionary

Definition at line 85 of file TernaryTrie.hpp.

◆ get_rootnode()

node_t tdc::lz78::TernaryTrie::get_rootnode ( uliteral_t  c) const
inline

Definition at line 74 of file TernaryTrie.hpp.

◆ IF_STATS()

tdc::lz78::TernaryTrie::IF_STATS ( size_t  m_resizes = 0;size_t m_specialresizes=0;)

◆ meta()

static Meta tdc::lz78::TernaryTrie::meta ( )
inlinestatic

Definition at line 28 of file TernaryTrie.hpp.

◆ operator=()

TernaryTrie& tdc::lz78::TernaryTrie::operator= ( TernaryTrie &&  other)
default

◆ size()

size_t tdc::lz78::TernaryTrie::size ( ) const
inline

Definition at line 138 of file TernaryTrie.hpp.


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