tudocomp
– The TU Dortmund Compression Framework
LZSSDecodeBackBuffer.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <ostream>
4 #include <vector>
5 #include <tudocomp/def.hpp>
6 
7 namespace tdc {
8 namespace lzss {
9 
11 
12 private:
13  std::vector<uliteral_t> m_buffer;
14  len_t m_cursor;
15 
16 public:
17 
18  inline DecodeBackBuffer(len_t size)
19  : m_cursor(0)
20  {
21  m_buffer.resize(size, 0);
22  }
23 
24  inline void decode_literal(uliteral_t c) {
25  m_buffer[m_cursor++] = c;
26  }
27 
28  inline void decode_factor(len_t pos, len_t num) {
29  while(num--) m_buffer[m_cursor++] = m_buffer[pos++];
30  }
31 
32  inline len_t longest_chain() const {
33  return 0;
34  }
35 
36  inline void write_to(std::ostream& out) {
37  for(auto c : m_buffer) out << c;
38  }
39 };
40 
41 }} //ns
42 
Contains the text compression and encoding framework.
Definition: namespaces.hpp:11
uint8_t uliteral_t
Type to represent signed single literals.
Definition: def.hpp:131
fast_t< len_compact_t > len_t
Type to represent an length value.
Definition: def.hpp:114
len_compact_t pos
Definition: LZSSFactors.hpp:38
void write_to(std::ostream &out)
void decode_factor(len_t pos, len_t num)