12 typename HashRoller = ZBackupRollingHash,
13 typename HashManager = SizeManagerNoob,
14 typename HashFunction = NoopHasher
17 typedef typename HashRoller::key_type key_type;
18 mutable HashRoller m_roller;
22 inline key_type hash_node(
uliteral_t c)
const {
29 Meta m(
"lz78trie",
"rolling_plus",
"Rolling Hash Trie+");
39 , m_roller(this->
env().env_for_option(
"hash_roller"))
40 , m_table(this->
env(), n, remaining_characters)
41 , m_table2(this->
env(),n,remaining_characters)
54 if(m_table2.
empty()) {
55 m_table.collect_stats(
env());
57 m_table2.collect_stats(
env());
66 m_table.
insert(std::make_pair<key_type,factorid_t>(hash_node(c),
size()));
85 if(!m_table2.
empty()) {
86 auto ret = m_table2.
insert(std::make_pair(hash_node(c), newleaf_id));
89 return node_t(newleaf_id,
true);
91 return node_t(ret.first.value(),
false);
95 auto ret = m_table.
insert(std::make_pair(hash_node(c), newleaf_id));
99 if(expected_size < m_table.
table_size()*2.0*0.95) {
105 return node_t(newleaf_id,
true);
107 return node_t(ret.first.value(),
false);
Contains the text compression and encoding framework.
const size_t & m_remaining_characters
#define tdc_unlikely(x)
Provides a hint to the compiler that x is expected to resolve to false.
uint8_t uliteral_t
Type to represent signed single literals.
std::pair< Iterator, bool > insert(std::pair< key_t, value_t > &&value)
node_t get_rootnode(uliteral_t c) const
node_t add_rootnode(uliteral_t c)
Env & env()
Provides access to the environment that the algorithm works in.
Default return type of find_or_insert.
RollingTriePlus(Env &&env, const size_t n, const size_t &remaining_characters, factorid_t reserve=0)
RollingTriePlus & operator=(RollingTriePlus &&other)=default
IF_STATS(MoveGuard m_guard;inline ~RollingTriePlus() { if(m_guard) { if(m_table2.empty()) { m_table.collect_stats(env());} else { m_table2.collect_stats(env());} } }) RollingTriePlus(RollingTriePlus &&other)=default
void incorporate(T &&o, len_t newsize)
uint32_t factorid_t
Type for the factor indices, bounded by the number of LZ78 trie nodes.
node_t find_or_insert(const node_t &, uliteral_t c)
float max_load_factor() const noexcept
Local environment for a compression/encoding/decompression call.
Interface for algorithms.