AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agxNet::Compress::Data Class Reference

#include <Compress.h>

+ Inheritance diagram for agxNet::Compress::Data:

Public Types

enum  Level { DEFAULT_COMPRESSION =-1 , MIN_COMPRESSION =0 , MAX_COMPRESSION =9 }
 Specifies a compression level. Default is zlib default compression level. More...
 
enum  Mode { NONE , COMPRESSED , DECOMPRESSED }
 

Public Member Functions

 Data (const char *source, size_t numBytes)
 Constructor which will create a Data object which contains a copy of the source data in compressed form.
 
 Data (Mode m=NONE)
 Default constructor.
 
char * data ()
 
const char * data () const
 
char * data (size_t idx)
 
const char * data (size_t idx) const
 
Mode getMode () const
 
float ratio () const
 
size_t size () const
 
bool valid () const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 

Protected Member Functions

virtual ~Data ()
 destructor
 
void allocate (size_t numBytes)
 Resize the data-buffer to fit numBytes.
 
size_t curr () const
 
char * currData ()
 
const char * currData () const
 
void finalize ()
 Make data valid and call any finalization of the compression/decompression structures.
 
int init (int level=DEFAULT_COMPRESSION)
 Initialize the compression/decompression with a specified compression level (only for compression)
 
void setCurr (size_t curr)
 set the current position in the bit stream (determines the pointer address of the returned value from currData()
 
void trim ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Definition at line 72 of file Compress.h.

Member Enumeration Documentation

◆ Level

Specifies a compression level. Default is zlib default compression level.

Enumerator
DEFAULT_COMPRESSION 
MIN_COMPRESSION 
MAX_COMPRESSION 

Definition at line 83 of file Compress.h.

◆ Mode

Enumerator
NONE 
COMPRESSED 
DECOMPRESSED 

Definition at line 75 of file Compress.h.

Constructor & Destructor Documentation

◆ Data() [1/2]

agxNet::Compress::Data::Data ( Mode  m = NONE)

Default constructor.

Parameters
m- the mode of the data

◆ Data() [2/2]

agxNet::Compress::Data::Data ( const char *  source,
size_t  numBytes 
)

Constructor which will create a Data object which contains a copy of the source data in compressed form.

I.e. mode will be COMPRESSED

◆ ~Data()

virtual agxNet::Compress::Data::~Data ( )
protectedvirtual

destructor

Member Function Documentation

◆ allocate()

void agxNet::Compress::Data::allocate ( size_t  numBytes)
inlineprotected

Resize the data-buffer to fit numBytes.

Definition at line 136 of file Compress.h.

◆ curr()

size_t agxNet::Compress::Data::curr ( ) const
inlineprotected
Returns
index of the current position in the bit-stream

Definition at line 130 of file Compress.h.

◆ currData() [1/2]

char * agxNet::Compress::Data::currData ( )
inlineprotected
Returns
a pointer to the data-buffer at the current index (set by setCurr).

Definition at line 139 of file Compress.h.

◆ currData() [2/2]

const char * agxNet::Compress::Data::currData ( ) const
inlineprotected
Returns
a const pointer to the data-buffer at the current index (set by setCurr).

Definition at line 142 of file Compress.h.

◆ data() [1/4]

char * agxNet::Compress::Data::data ( )
inline
Returns
a pointer to the bit-stream (compressed or non-compressed).

Definition at line 110 of file Compress.h.

◆ data() [2/4]

const char * agxNet::Compress::Data::data ( ) const
inline
Returns
a const pointer to the bit-stream (compressed or non-compressed).

Definition at line 113 of file Compress.h.

◆ data() [3/4]

char * agxNet::Compress::Data::data ( size_t  idx)
inline
Returns
a pointer to the bit-stream (compressed or non-compressed).

Definition at line 116 of file Compress.h.

◆ data() [4/4]

const char * agxNet::Compress::Data::data ( size_t  idx) const
inline
Returns
a const pointer to the bit-stream (compressed or non-compressed).

Definition at line 119 of file Compress.h.

◆ finalize()

void agxNet::Compress::Data::finalize ( )
protected

Make data valid and call any finalization of the compression/decompression structures.

◆ getMode()

Mode agxNet::Compress::Data::getMode ( ) const
inline
Returns
the current mode for the data, compressed/decompressed/none

Definition at line 91 of file Compress.h.

◆ init()

int agxNet::Compress::Data::init ( int  level = DEFAULT_COMPRESSION)
protected

Initialize the compression/decompression with a specified compression level (only for compression)

◆ ratio()

float agxNet::Compress::Data::ratio ( ) const
inline
Returns
the compression ratio of the data, for decompressed data it returns 1.0

Definition at line 125 of file Compress.h.

◆ setCurr()

void agxNet::Compress::Data::setCurr ( size_t  curr)
inlineprotected

set the current position in the bit stream (determines the pointer address of the returned value from currData()

Definition at line 133 of file Compress.h.

◆ size()

size_t agxNet::Compress::Data::size ( ) const
inline
Returns
the number of bytes in the data vector

Definition at line 107 of file Compress.h.

◆ trim()

void agxNet::Compress::Data::trim ( )
protected

◆ valid()

bool agxNet::Compress::Data::valid ( ) const
inline
Returns
true if the data is valid, compression/uncompression was succesfully done.

Definition at line 122 of file Compress.h.


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