3 #include <unordered_set> 19 o <<
"[" << int(tb.type) <<
"]";
20 }
else if (tb.len == 2) {
21 o <<
"[ " << int(tb.type) <<
" ]";
22 }
else if (tb.len == 3) {
23 o <<
"[ " << int(tb.type) <<
" ]";
25 o <<
"<Err: " << tb <<
">";
36 m_view(v), m_alpha(alpha) {}
38 friend std::ostream& operator<<(std::ostream&, const DebugPrint<U>&);
48 inline std::ostream& operator<<(std::ostream& o, const DebugPrint<T>& d) {
49 if (d.m_alpha == 256) {
51 for (
auto c: d.m_view) {
52 o << char(uint8_t(c));
71 std::unordered_set<size_t> alpha;
72 for (
const auto& v : t) {
80 for(
size_t i = 1; i < t.size(); i++) {
81 if (t[i] == t[i - 1])
return false;
86 template<
class T,
class F>
88 for (
size_t i = 0; i < t.size(); i++) {
89 std::array<typename T::value_type, 2> neighbors;
90 uint8_t neighbor_len = 0;
92 if (i == 0 && i == t.size() - 1) {
96 neighbors[0] = t[i + 1];
97 }
else if (i == t.size() - 1) {
99 neighbors[0] = t[i - 1];
102 neighbors[0] = t[i - 1];
103 neighbors[1] = t[i + 1];
Contains the text compression and encoding framework.
std::string vec_to_debug_string(const T &s, size_t indent=0)
Builds the string representation of a vector of byte values, sorrounded by square brackets ([ and ])...
A view into a slice of memory.
A const view into a slice of memory.
DebugPrint< T > debug_p(ConstGenericView< T > v, size_t alpha)
DebugPrint(ConstGenericView< T > v, size_t alpha)
bool no_adjacent_identical(const T &t)
std::ostream & nice_block_lengths(GenericView< TypedBlock > tbs, std::ostream &o)
void do_for_neighbors(T &t, F f)
uint64_t calc_alphabet_size(const T &t)