21 Meta m(
"lcpcomp_dec",
"compact");
34 IF_STATS(
len_t m_longest_chain);
35 IF_STATS(
len_t m_current_chain);
40 IF_STATS(++m_current_chain);
41 IF_STATS(m_longest_chain = std::max(m_longest_chain, m_current_chain));
44 DCHECK(c != 0 || pos == m_buffer.
size()-1);
46 if(m_fwd[pos] !=
nullptr) {
48 for(
size_t i = 1; i < bucket[0]; ++i) {
49 decode_literal_at(bucket[i], c);
55 IF_STATS(--m_current_chain);
61 m_fwd(
std::move(other.m_fwd)),
62 m_cursor(
std::move(other.m_cursor)),
63 m_buffer(
std::move(other.m_buffer))
65 IF_STATS(m_longest_chain = std::move(other.m_longest_chain));
66 IF_STATS(m_current_chain = std::move(other.m_current_chain));
68 other.m_fwd =
nullptr;
72 if(m_fwd !=
nullptr) {
73 for(
size_t i = 0; i < m_buffer.
size(); ++i) {
74 if(m_fwd[i] ==
nullptr)
continue;
83 IF_STATS(m_longest_chain = 0);
84 IF_STATS(m_current_chain = 0);
87 std::fill(m_fwd,m_fwd+size,
nullptr);
91 decode_literal_at(m_cursor++, c);
95 for(
len_t i = 0; i < num; i++) {
98 decode_literal_at(m_cursor, m_buffer[src]);
101 if(bucket ==
nullptr) {
103 DCHECK(m_fwd[src] == bucket);
105 bucket[1] = m_cursor;
111 bucket[bucket[0]-1] = m_cursor;
120 inline len_t longest_chain()
const {
121 return m_longest_chain;
124 inline void write_to(std::ostream& out)
const {
125 for(
auto c : m_buffer) out << c;
void decode_factor(len_t pos, len_t num)
Contains the text compression and encoding framework.
A vector over arbitrary unsigned integer types.
uint8_t uliteral_t
Type to represent signed single literals.
Env & env()
Provides access to the environment that the algorithm works in.
Decodes lcpcomp compressed data as described in the paper.
CompactDec(CompactDec &&other)
uint32_t len_compact_t
Type to represent an bit-compact length value.
fast_t< len_compact_t > len_t
Type to represent an length value.
void decode_literal(uliteral_t c)
void decode_eagerly() const
CompactDec(Env &&env, len_t size)
Local environment for a compression/encoding/decompression call.
Interface for algorithms.