AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agxNet::Compress Class Reference

Class for compressing data given a bit-stream. More...

#include <Compress.h>

Classes

class  Data
 

Public Types

typedef agx::observer_ptr
< const Data > 
DataConstObserver
 
typedef agx::ref_ptr< const Data > DataConstRef
 
typedef agx::observer_ptr< Data > DataObserver
 
typedef agx::ref_ptr< Data > DataRef
 

Public Member Functions

 Compress ()
 Default constructor. More...
 
 ~Compress ()
 Destructor. More...
 
 AGX_DECLARE_VECTOR_TYPES (Data)
 

Static Public Member Functions

static DataRef compress (const char *source, size_t numBytes, int level=-1)
 Compress a bit-stream with size numBytes. More...
 
static DataRef decompress (const char *source, size_t numBytes)
 Decompress a bit-stream with size numBytes. More...
 
static DataRef decompress (Data *source)
 Decompress a compressed Data object. More...
 

Detailed Description

Class for compressing data given a bit-stream.

zlib is used for compression.

Usage: DataRef compressed = Compress::compress(charPtr, numBytes, level);

compressed will now contain the compressed data. Accessing raw compressed bit-stream is done by:

char *ptr = compressed->data(); size_t numBytes = compressed->size();

ZLIB default compression level is the default.

Decompression is done by:

DataRef decompressed = Compress::decompress(compressed->data(), compressed->size());

(if you don't have a Data object)

or:

DataRef decompressed = Compress::decompress(compressed);

If you have the compressed bit-stream in a Data object.

Definition at line 56 of file Compress.h.

Member Typedef Documentation

Definition at line 71 of file Compress.h.

Definition at line 71 of file Compress.h.

Definition at line 71 of file Compress.h.

Definition at line 71 of file Compress.h.

Constructor & Destructor Documentation

agxNet::Compress::Compress ( )

Default constructor.

agxNet::Compress::~Compress ( )

Destructor.

Member Function Documentation

agxNet::Compress::AGX_DECLARE_VECTOR_TYPES ( Data  )
static DataRef agxNet::Compress::compress ( const char *  source,
size_t  numBytes,
int  level = -1 
)
static

Compress a bit-stream with size numBytes.

Parameters
source- pointer to the bit-stream
numBytes- Number of bytes in the input bit-stream
level- the desired compression level, default is the default zlib compression level
Returns
ref_ptr to a Data object with the compressed data. If compression failed nullptr (null) is returned.
static DataRef agxNet::Compress::decompress ( const char *  source,
size_t  numBytes 
)
static

Decompress a bit-stream with size numBytes.

Parameters
source- pointer to the bit-stream
numBytes- Number of bytes in the input bit-stream
Returns
ref_ptr to a Data object with the de-compressed data. If de-compression failed nullptr (null) is returned.
static DataRef agxNet::Compress::decompress ( Data *  source)
static

Decompress a compressed Data object.

Parameters
source- pointer to the Data object containing the compressed data.
Returns
ref_ptr to a Data object with the de-compressed data. If de-compression failed nullptr (null) is returned.

The documentation for this class was generated from the following file: