Tkrzw
Public Member Functions | List of all members
tkrzw::LZ4Compressor Class Referencefinal

Complessor implemeted with LZ4. More...

#include <tkrzw_compress.h>

Public Member Functions

 LZ4Compressor (int32_t acceleration=1)
 Constructor.
 
virtual ~LZ4Compressor ()
 Destructor.
 
bool IsSupported () const override
 Checks whether the implementation is actually supported.
 
char * Compress (const void *buf, size_t size, size_t *sp) override
 Compresses a serial data.
 
char * Decompress (const void *buf, size_t size, size_t *sp) override
 Decompresses a serial data.
 
std::unique_ptr< CompressorMakeCompressor () const override
 Makes a new Compressor object of the same concrete class.
 
- Public Member Functions inherited from tkrzw::Compressor
virtual ~Compressor ()=default
 Destructor.
 
virtual bool IsSupported () const =0
 Checks whether the implementation is actually supported.
 
virtual char * Compress (const void *buf, size_t size, size_t *sp)=0
 Compresses a serial data.
 
virtual char * Decompress (const void *buf, size_t size, size_t *sp)=0
 Decompresses a serial data.
 
virtual std::unique_ptr< CompressorMakeCompressor () const =0
 Makes a new Compressor object of the same concrete class.
 
const std::type_info & GetType () const
 Gets the type information of the actual class.
 

Detailed Description

Complessor implemeted with LZ4.

Constructor & Destructor Documentation

◆ LZ4Compressor()

tkrzw::LZ4Compressor::LZ4Compressor ( int32_t  acceleration = 1)
explicit

Constructor.

Parameters
accelerationThe accelaration level which is 1 or more. Increasing it by 1 means 3-4% speed boost with less compression ratio.

◆ ~LZ4Compressor()

virtual tkrzw::LZ4Compressor::~LZ4Compressor ( )
virtual

Destructor.

Member Function Documentation

◆ IsSupported()

bool tkrzw::LZ4Compressor::IsSupported ( ) const
overridevirtual

Checks whether the implementation is actually supported.

Returns
True if the implementation is actually supported.

Implements tkrzw::Compressor.

◆ Compress()

char * tkrzw::LZ4Compressor::Compress ( const void *  buf,
size_t  size,
size_t *  sp 
)
overridevirtual

Compresses a serial data.

Parameters
bufthe input buffer.
sizethe size of the input buffer.
spthe pointer to the variable into which the size of the region of the return value is assigned.
Returns
The pointer to the result data, or nullptr on failure.

Because the region of the return value is allocated with the xmalloc function, it should be released with the xfree function.

Implements tkrzw::Compressor.

◆ Decompress()

char * tkrzw::LZ4Compressor::Decompress ( const void *  buf,
size_t  size,
size_t *  sp 
)
overridevirtual

Decompresses a serial data.

Parameters
bufthe input buffer.
sizethe size of the input buffer.
spthe pointer to the variable into which the size of the region of the return value is assigned.
Returns
The pointer to the result data, or nullptr on failure.

Because the region of the return value is allocated with the xmalloc function, it should be released with the xfree function.

Implements tkrzw::Compressor.

◆ MakeCompressor()

std::unique_ptr< Compressor > tkrzw::LZ4Compressor::MakeCompressor ( ) const
overridevirtual

Makes a new Compressor object of the same concrete class.

Returns
The new Compressor object.

Implements tkrzw::Compressor.