MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Class providing gzip compression. More...
#include <mdsGZipCompressor.h>
Public Types | |
enum | { CLASS_OBJECT } |
Templates that require members of the CObject class can use this enum to check the existence. More... | |
enum | { HEAP_OBJECT = 0x70616568 } |
Signature used to recognize objects on the heap. More... | |
typedef mds::base::CLibraryLockableObject < CChannel >::CLock | tLock |
Lock that have to be used to provide mutual access to write(), read() and etc. | |
Public Member Functions | |
CGZipCompressor (CChannel *channel=NULL, unsigned int level=DEFAULT_COMPRESSION_LEVEL) | |
Default constructor. | |
bool | checkMedium (int Medium) const |
Checks if channel medium is equal to a given value. | |
bool | checkType (int Type) const |
Checks if channel type corresponds to a given value. | |
virtual bool | connect (unsigned uTimeout=CH_CONNECTION_TIMEOUT) |
Connects to the opposite channel side. | |
virtual void | disconnect () |
Disconnects from the opossite channel side. | |
virtual bool | flush () |
Finalizes all writing operations (flushes internal buffers, etc.). | |
CChannel * | getChannel () |
Returns pointer to the input/output channel. | |
int | getCompressionMethod () const |
Returns the compression method. | |
int | getMedium () const |
Returns the channel medium. | |
int | getReferencesCount () const |
Returns the number of references. | |
int | getType () const |
Method returns the channel type. | |
virtual bool | isConnected () |
Method for testing channel errors such as: | |
bool | isOnHeap () const |
Returns true if the object is allocated on the heap. | |
virtual bool | listen (unsigned uTimeout=CH_CONNECTION_TIMEOUT) |
Listens for the opposite channel side. | |
void | lock () |
Locks the object. | |
MDS_SHAREDPTR (CGZipCompressor) | |
Smart pointer type. | |
MDS_SHAREDPTR (CChannelCompressor) | |
Smart pointer type. | |
MDS_SHAREDPTR (CChannel) | |
Smart pointer type. | |
virtual int | read (char *data, int length) |
Reads and decompresses data from the input channel. | |
virtual void | setChannel (CChannel *pChannel) |
Sets the input/output channel. | |
virtual bool | skip (int iLength) |
Skips a given number of bytes. | |
void | unlock () |
Locks the object. | |
virtual bool | wait (unsigned uTimeout=CH_WAIT_TIMEOUT) |
Waits for data. | |
virtual bool | write (const char *data, int length) |
Writes compressed data to the output channel. | |
virtual | ~CGZipCompressor () |
Virtual destructor. | |
Static Public Member Functions | |
static CChannelCompressor * | create (int CompressionMethod, CChannel *pChannel) |
Channel compressor creation function. | |
static CChannel * | create (EChannelType eType, const std::string &sDesc) |
Creation of a channel which is described by a textual string. | |
static void * | operator new (std::size_t Size) |
Allocates a new object on the heap. | |
static void | separate (const std::string &sDescs, std::vector< std::string > &Descs) |
Parses a given string and separates descriptions of several channels. | |
Static Public Attributes | |
static const unsigned int | DEFAULT_COMPRESSION_LEVEL = 6 |
Default compression level. | |
Protected Types | |
enum | { BUFFER_SIZE = 4 * 1024 } |
Internal buffer size. More... | |
typedef mds::base::CStaticData < char, BUFFER_SIZE > | tData |
Storage used by internal buffers. | |
Protected Member Functions | |
void | addReference () const |
Increase the reference counter. | |
bool | delReference () const |
Decrease the reference counter. | |
Protected Attributes | |
int | m_ChannelCompression |
Compression method. | |
tData | m_compressionBuffer |
Internal buffers. | |
z_stream | m_compressionStream |
ZLib streams. | |
tSize | m_decompressedTotal |
tSize | m_decompressedUsed |
tData | m_decompressionBuffer |
z_stream | m_decompressionStream |
int | m_iHeapObject |
Flag initialized if the object is on the heap. | |
int | m_iReferences |
The number of references to the object. | |
int | m_Medium |
Channel medium. | |
tData | m_readBuffer |
CChannelPtr | m_spChannel |
Output/input channel. | |
int | m_Type |
Channel type. |
Class providing gzip compression.
typedef mds::base::CStaticData<char, BUFFER_SIZE> mds::mod::CGZipCompressor::tData [protected] |
Storage used by internal buffers.
typedef mds::base::CLibraryLockableObject<CChannel>::CLock mds::mod::CChannel::tLock [inherited] |
anonymous enum [inherited] |
Templates that require members of the CObject class can use this enum to check the existence.
mds::mod::CGZipCompressor::CGZipCompressor | ( | CChannel * | channel = NULL , |
unsigned int | level = DEFAULT_COMPRESSION_LEVEL |
||
) |
Default constructor.
mds::mod::CGZipCompressor::~CGZipCompressor | ( | ) | [virtual] |
Virtual destructor.
void mds::base::CObject::addReference | ( | ) | const [protected, inherited] |
Increase the reference counter.
bool mds::mod::CChannel::checkMedium | ( | int | Medium | ) | const [inherited] |
Checks if channel medium is equal to a given value.
bool mds::mod::CChannel::checkType | ( | int | Type | ) | const [inherited] |
Checks if channel type corresponds to a given value.
virtual bool mds::mod::CChannelCompressor::connect | ( | unsigned | uTimeout = CH_CONNECTION_TIMEOUT | ) | [virtual, inherited] |
Connects to the opposite channel side.
Implements mds::mod::CChannel.
CChannelCompressor * mds::mod::CChannelCompressor::create | ( | int | CompressionMethod, |
CChannel * | pChannel | ||
) | [static, inherited] |
Channel compressor creation function.
CChannel * mds::mod::CChannel::create | ( | EChannelType | eType, |
const std::string & | sDesc | ||
) | [static, inherited] |
Creation of a channel which is described by a textual string.
bool mds::base::CObject::delReference | ( | ) | const [protected, inherited] |
Decrease the reference counter.
virtual void mds::mod::CChannelCompressor::disconnect | ( | ) | [virtual, inherited] |
Disconnects from the opossite channel side.
Implements mds::mod::CChannel.
bool mds::mod::CGZipCompressor::flush | ( | ) | [virtual] |
Finalizes all writing operations (flushes internal buffers, etc.).
Reimplemented from mds::mod::CChannelCompressor.
CChannel* mds::mod::CChannelCompressor::getChannel | ( | ) | [inherited] |
Returns pointer to the input/output channel.
int mds::mod::CChannelCompressor::getCompressionMethod | ( | ) | const [inherited] |
Returns the compression method.
int mds::mod::CChannel::getMedium | ( | ) | const [inherited] |
Returns the channel medium.
int mds::base::CObject::getReferencesCount | ( | ) | const [inherited] |
Returns the number of references.
int mds::mod::CChannel::getType | ( | ) | const [inherited] |
Method returns the channel type.
virtual bool mds::mod::CChannelCompressor::isConnected | ( | ) | [virtual, inherited] |
Method for testing channel errors such as:
Implements mds::mod::CChannel.
bool mds::base::CObject::isOnHeap | ( | ) | const [inherited] |
Returns true if the object is allocated on the heap.
virtual bool mds::mod::CChannelCompressor::listen | ( | unsigned | uTimeout = CH_CONNECTION_TIMEOUT | ) | [virtual, inherited] |
Listens for the opposite channel side.
Implements mds::mod::CChannel.
void mds::base::CLockableObject< CChannel >::lock | ( | ) | [inherited] |
Locks the object.
Smart pointer type.
mds::mod::CChannelCompressor::MDS_SHAREDPTR | ( | CChannelCompressor | ) | [inherited] |
Smart pointer type.
mds::mod::CChannel::MDS_SHAREDPTR | ( | CChannel | ) | [inherited] |
Smart pointer type.
static void* mds::base::CObject::operator new | ( | std::size_t | Size | ) | [static, inherited] |
Allocates a new object on the heap.
int mds::mod::CGZipCompressor::read | ( | char * | data, |
int | length | ||
) | [virtual] |
Reads and decompresses data from the input channel.
Implements mds::mod::CChannelCompressor.
void mds::mod::CChannel::separate | ( | const std::string & | sDescs, |
std::vector< std::string > & | Descs | ||
) | [static, inherited] |
Parses a given string and separates descriptions of several channels.
virtual void mds::mod::CChannelCompressor::setChannel | ( | CChannel * | pChannel | ) | [virtual, inherited] |
Sets the input/output channel.
Reimplemented in mds::mod::CDensityCompressor.
bool mds::mod::CChannel::skip | ( | int | iLength | ) | [virtual, inherited] |
Skips a given number of bytes.
Reimplemented in mds::mod::CSharedMemChannel, and mds::mod::CMemoryChannel.
void mds::base::CLockableObject< CChannel >::unlock | ( | ) | [inherited] |
Locks the object.
virtual bool mds::mod::CChannelCompressor::wait | ( | unsigned | uTimeout = CH_WAIT_TIMEOUT | ) | [virtual, inherited] |
Waits for data.
Implements mds::mod::CChannel.
bool mds::mod::CGZipCompressor::write | ( | const char * | data, |
int | length | ||
) | [virtual] |
Writes compressed data to the output channel.
Implements mds::mod::CChannelCompressor.
const unsigned int mds::mod::CGZipCompressor::DEFAULT_COMPRESSION_LEVEL = 6 [static] |
Default compression level.
int mds::mod::CChannelCompressor::m_ChannelCompression [protected, inherited] |
Compression method.
tData mds::mod::CGZipCompressor::m_compressionBuffer [protected] |
Internal buffers.
z_stream mds::mod::CGZipCompressor::m_compressionStream [protected] |
ZLib streams.
tSize mds::mod::CGZipCompressor::m_decompressedTotal [protected] |
tSize mds::mod::CGZipCompressor::m_decompressedUsed [protected] |
z_stream mds::mod::CGZipCompressor::m_decompressionStream [protected] |
int mds::base::CObject::m_iHeapObject [mutable, protected, inherited] |
Flag initialized if the object is on the heap.
int mds::base::CObject::m_iReferences [mutable, protected, inherited] |
The number of references to the object.
int mds::mod::CChannel::m_Medium [protected, inherited] |
Channel medium.
tData mds::mod::CGZipCompressor::m_readBuffer [protected] |
CChannelPtr mds::mod::CChannelCompressor::m_spChannel [protected, inherited] |
Output/input channel.
int mds::mod::CChannel::m_Type [protected, inherited] |
Channel type.