clockUtils  1.1
Compression

Namespaces

 clockUtils
 

Macros

#define CLOCK_COMPRESSION_API
 

Detailed Description

The compression library can be used to easily compress and decompress using different compression algorithms

How to use the compression library

You need to include this header

and also at least the one for the algorithm used for compression.


To compress a std::string you just need to call the compress method of the Compression class.
Currently we offer two similar compression algorithms both implementing Huffman encoding. These two algorithms are:

  • HuffmanFixed uses a fixed dictionary for the Huffman encoding. This results in a smaller compressed string because of the hardocded header, but can't optimize strings depending on their content. It's better than HuffmanGeneric at least in cases you have short strings <= 512 Bytes.
  • HuffmanGeneric generates the dictionary depending on the string being encoded. This means there are always 256 Byte just for the header in every string, but long strings can be reduced in a better way than HuffmanFixed can do.

If you want to compress a string, just follow these steps:

std::string uncompressedString = "blafoo";
std::string compressedString = c.compress(uncompressedString);
std::string decompressedString = c.decompress(compressedString);

The string is compressed and decompressed and decompressedString is equal to uncompressedString again.

Macro Definition Documentation

§ CLOCK_COMPRESSION_API

#define CLOCK_COMPRESSION_API

Definition at line 40 of file compressionParameters.h.