Kyoto Cabinet
Public Types | Static Public Member Functions
kyotocabinet::LZO Class Reference

LZO compressor. More...

#include <kccompress.h>

List of all members.

Public Types

enum  Mode { RAW, CRC }
 Compression modes. More...

Static Public Member Functions

static char * compress (const void *buf, size_t size, size_t *sp, Mode mode=RAW)
 Compress a serial data.
static char * decompress (const void *buf, size_t size, size_t *sp, Mode mode=RAW)
 Decompress a serial data.
static uint32_t calculate_crc (const void *buf, size_t size, uint32_t seed=0)
 Calculate the CRC32 checksum of a serial data.

Detailed Description

LZO compressor.


Member Enumeration Documentation

Compression modes.

Enumerator:
RAW 

without any checksum

CRC 

with CRC32 checksum


Member Function Documentation

static char* kyotocabinet::LZO::compress ( const void *  buf,
size_t  size,
size_t *  sp,
Mode  mode = RAW 
) [static]

Compress 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.
modethe compression mode.
Returns:
the pointer to the result data, or NULL on failure.
Note:
Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.
static char* kyotocabinet::LZO::decompress ( const void *  buf,
size_t  size,
size_t *  sp,
Mode  mode = RAW 
) [static]

Decompress 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.
modethe compression mode.
Returns:
the pointer to the result data, or NULL on failure.
Note:
Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a C-style string. Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.
static uint32_t kyotocabinet::LZO::calculate_crc ( const void *  buf,
size_t  size,
uint32_t  seed = 0 
) [static]

Calculate the CRC32 checksum of a serial data.

Parameters:
bufthe input buffer.
sizethe size of the input buffer.
seedthe cyclic seed value.
Returns:
the CRC32 checksum.