eckit::Compressor class

Derived classes

class AECCompressor
class BZip2Compressor
class LZ4Compressor
class NoCompressor
class SnappyCompressor

Constructors, destructors, conversion operators

Compressor()
~Compressor() virtual

Public functions

auto compress(const void* in, size_t len, eckit::Buffer& out) const -> size_t pure virtual
void uncompress(const void* in, size_t len, eckit::Buffer& out, size_t outlen) const pure virtual

Function documentation

size_t eckit::Compressor::compress(const void* in, size_t len, eckit::Buffer& out) const pure virtual

Parameters
in input buffer that holds the uncompressed bytesteam.
len input buffer size.
out output buffer to hold the compressed bytesteam. Buffer may be oversized, in which case resizing is implementation specific. Nevertheless, it is expected that implementations will take this as oppurtunity for optimising and avoid resizing.
Returns the size of the compressed bytestream inside out buffer, it is less or equal than out.size()

Compresses the bytestream within the in buffer

void eckit::Compressor::uncompress(const void* in, size_t len, eckit::Buffer& out, size_t outlen) const pure virtual

Parameters
in input buffer that holds the compressed bytesteam.
len input buffer size.
out output buffer to hold the uncompressed bytesteam.
outlen the expected size of the uncompressed bytestream. Buffer may be resized or if large enough implementations will try to used what is passed in. This could be a way to reuse the same memory buffer in a tight loop.

Uncompresses the bytestream within the in buffer Since some compression algorithms dont record uncompressed size in the bytestream, client code is required to record and handle the uncompressed size separately and pass it in via parameter outlen.