99#ifndef __ADS_LempelZiv
100 #define __ADS_LempelZiv
116#include <string_view>
117#include <unordered_map>
191[[nodiscard]]
inline std::vector< LZ77Phrase >
193 std::size_t w = std::numeric_limits< std::size_t >::max() );
214[[nodiscard]]
inline std::string
239[[nodiscard]]
inline std::vector< LZSSPhrase >
241 std::size_t w = std::numeric_limits< std::size_t >::max() ,
242 std::size_t minLength = 1 );
285 std::string_view s , std::size_t w , std::size_t minLength = 3 ,
286 std::size_t maxChain = std::numeric_limits< std::size_t >::max() );
305[[nodiscard]]
inline std::string
335[[nodiscard]]
inline std::vector< LZ78Phrase >
lz78Parse(
337 std::size_t maxPhrases = std::numeric_limits< std::size_t >::max() );
358 const std::vector< LZ78Phrase > & P ,
359 std::size_t maxPhrases = std::numeric_limits< std::size_t >::max() );
382[[nodiscard]]
inline std::vector< std::uint32_t >
406[[nodiscard]]
inline std::string
417#include "ADS/compression/impl/LempelZiv.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::vector< LZSSPhrase > lzssParseHashed(std::string_view s, std::size_t w, std::size_t minLength=3, std::size_t maxChain=std::numeric_limits< std::size_t >::max())
the parse of LZSS of by the chains of the hashes of 3 symbols, as in gzip, following at most maxChai...
std::string lzwDecode(const std::vector< std::uint32_t > &I)
the text of the code of LZW
std::vector< std::uint32_t > lzwEncode(std::string_view s)
the identifiers of the code of LZW of
std::string lz77Decode(const std::vector< LZ77Phrase > &P)
the text of the phrases of LZ77
std::vector< LZ78Phrase > lz78Parse(std::string_view s, std::size_t maxPhrases=std::numeric_limits< std::size_t >::max())
the parse of LZ78 of , the dictionary restarting when it has maxPhrases phrases besides the empty one
std::string lzssDecode(const std::vector< LZSSPhrase > &P)
the text of the phrases of LZSS
std::vector< LZ77Phrase > lz77Parse(std::string_view s, std::size_t w=std::numeric_limits< std::size_t >::max())
the parse of LZ77 of with a window of symbols, the closest among the longest copies
std::string lz78Decode(const std::vector< LZ78Phrase > &P, std::size_t maxPhrases=std::numeric_limits< std::size_t >::max())
the text of the phrases of LZ78
std::vector< LZSSPhrase > lzssParse(std::string_view s, std::size_t w=std::numeric_limits< std::size_t >::max(), std::size_t minLength=1)
the parse of LZSS of with a window of symbols, a copy for the closest among the longest prefixes of...
a phrase of LZ77: copy length symbols from distance back, then next (none at the end of the text); di...
Definition LempelZiv.h:131
friend bool operator==(const LZ77Phrase &a, const LZ77Phrase &b)=default
whether the two phrases are equal
std::size_t distance
how far back the copy starts
Definition LempelZiv.h:132
std::size_t length
the symbols copied
Definition LempelZiv.h:133
std::optional< char > next
the symbol after the copy, if any
Definition LempelZiv.h:134
a phrase of LZ78: the phrase id followed by next
Definition LempelZiv.h:154
std::size_t id
the phrase of the dictionary, 0 the empty one
Definition LempelZiv.h:155
friend bool operator==(const LZ78Phrase &a, const LZ78Phrase &b)=default
whether the two phrases are equal
char next
the symbol that follows it
Definition LempelZiv.h:156
a phrase of LZSS: a copy of length symbols from distance back, or the literal when distance is 0
Definition LempelZiv.h:143
char literal
the symbol of a literal
Definition LempelZiv.h:146
std::size_t distance
how far back the copy starts, 0 for a literal
Definition LempelZiv.h:144
friend bool operator==(const LZSSPhrase &a, const LZSSPhrase &b)=default
whether the two phrases are equal
std::size_t length
the symbols copied, 1 for a literal
Definition LempelZiv.h:145