MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Base abstract class for all classes implementing channels. More...
#include <mdsChannel.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 | |
CChannel () | |
Exception thrown from constructor, or the create() method, in case of some error. | |
CChannel (int Medium, int Type) | |
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)=0 |
Connects to the opposite channel side. | |
virtual void | disconnect ()=0 |
Disconnects from the opossite channel side. | |
virtual bool | flush ()=0 |
Finalizes all writing/reading operations (flushes internal buffers, etc.). | |
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 ()=0 |
Method for testing channel errors such as: disconnected or broken channel, reading after end of input, etc. | |
bool | isOnHeap () const |
Returns true if the object is allocated on the heap. | |
virtual bool | listen (unsigned uTimeout=CH_CONNECTION_TIMEOUT)=0 |
Listens for and accepts an incoming connection. | |
void | lock () |
Locks the object. | |
MDS_SHAREDPTR (CChannel) | |
Smart pointer type. | |
virtual int | read (char *pcData, int iLength)=0 |
Reads bytes from the input 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)=0 |
Waits for data. | |
virtual bool | write (const char *pcData, int iLength)=0 |
Writes data to the output channel. | |
virtual | ~CChannel () |
Virtual destructor. | |
Static Public Member Functions | |
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. | |
Protected Member Functions | |
void | addReference () const |
Increase the reference counter. | |
bool | delReference () const |
Decrease the reference counter. | |
Protected Attributes | |
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. | |
int | m_Type |
Channel type. |
Base abstract class for all classes implementing channels.
anonymous enum [inherited] |
Templates that require members of the CObject class can use this enum to check the existence.
Exception thrown from constructor, or the create() method, in case of some error.
Default constructor.
mds::mod::CChannel::CChannel | ( | int | Medium, |
int | Type | ||
) |
Constructor.
virtual mds::mod::CChannel::~CChannel | ( | ) | [virtual] |
Virtual destructor.
void mds::base::CObject::addReference | ( | ) | const [protected, inherited] |
Increase the reference counter.
bool mds::mod::CChannel::checkMedium | ( | int | Medium | ) | const |
Checks if channel medium is equal to a given value.
bool mds::mod::CChannel::checkType | ( | int | Type | ) | const |
Checks if channel type corresponds to a given value.
virtual bool mds::mod::CChannel::connect | ( | unsigned | uTimeout = CH_CONNECTION_TIMEOUT | ) | [pure virtual] |
Connects to the opposite channel side.
Implemented in mds::mod::CSharedMemChannel, mds::mod::CPipeChannel, mds::mod::CFileChannelU, mds::mod::CFileChannel, mds::mod::CStdChannel, mds::mod::CNullChannel, mds::mod::CChannelCompressor, mds::mod::CPredictorChannel, mds::mod::CMemoryChannel, and mds::mod::CBlockChannel.
CChannel * mds::mod::CChannel::create | ( | EChannelType | eType, |
const std::string & | sDesc | ||
) | [static] |
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::CChannel::disconnect | ( | ) | [pure virtual] |
Disconnects from the opossite channel side.
Implemented in mds::mod::CSharedMemChannel, mds::mod::CPipeChannel, mds::mod::CFileChannelU, mds::mod::CFileChannel, mds::mod::CStdChannel, mds::mod::CNullChannel, mds::mod::CChannelCompressor, mds::mod::CPredictorChannel, mds::mod::CBlockChannel, and mds::mod::CMemoryChannel.
virtual bool mds::mod::CChannel::flush | ( | ) | [pure virtual] |
Finalizes all writing/reading operations (flushes internal buffers, etc.).
Implemented in mds::mod::CSharedMemChannel, mds::mod::CPipeChannel, mds::mod::CFileChannelU, mds::mod::CFileChannel, mds::mod::CStdChannel, mds::mod::CNullChannel, mds::mod::CChannelCompressor, mds::mod::CPredictorChannel, mds::mod::CBlockChannel, mds::mod::CMemoryChannel, and mds::mod::CGZipCompressor.
int mds::mod::CChannel::getMedium | ( | ) | const |
Returns the channel medium.
int mds::base::CObject::getReferencesCount | ( | ) | const [inherited] |
Returns the number of references.
int mds::mod::CChannel::getType | ( | ) | const |
Method returns the channel type.
virtual bool mds::mod::CChannel::isConnected | ( | ) | [pure virtual] |
Method for testing channel errors such as: disconnected or broken channel, reading after end of input, etc.
Implemented in mds::mod::CSharedMemChannel, mds::mod::CPipeChannel, mds::mod::CFileChannelU, mds::mod::CFileChannel, mds::mod::CStdChannel, mds::mod::CNullChannel, mds::mod::CChannelCompressor, mds::mod::CPredictorChannel, mds::mod::CBlockChannel, and mds::mod::CMemoryChannel.
bool mds::base::CObject::isOnHeap | ( | ) | const [inherited] |
Returns true if the object is allocated on the heap.
virtual bool mds::mod::CChannel::listen | ( | unsigned | uTimeout = CH_CONNECTION_TIMEOUT | ) | [pure virtual] |
Listens for and accepts an incoming connection.
Implemented in mds::mod::CSharedMemChannel, mds::mod::CPipeChannel, mds::mod::CFileChannelU, mds::mod::CFileChannel, mds::mod::CStdChannel, mds::mod::CNullChannel, mds::mod::CChannelCompressor, mds::mod::CPredictorChannel, mds::mod::CBlockChannel, and mds::mod::CMemoryChannel.
void mds::base::CLockableObject< CChannel >::lock | ( | ) | [inherited] |
Locks the object.
Smart pointer type.
static void* mds::base::CObject::operator new | ( | std::size_t | Size | ) | [static, inherited] |
Allocates a new object on the heap.
virtual int mds::mod::CChannel::read | ( | char * | pcData, |
int | iLength | ||
) | [pure virtual] |
Reads bytes from the input channel.
Implemented in mds::mod::CSharedMemChannel, mds::mod::CPipeChannel, mds::mod::CFileChannelU, mds::mod::CFileChannel, mds::mod::CStdChannel, mds::mod::CNullChannel, mds::mod::CDensityPredictor, mds::mod::CRawCompressor, mds::mod::CByteTranspose< T >, mds::mod::CChannelCompressor, mds::mod::CPredictorChannel, mds::mod::CBlockChannel, mds::mod::CRLE16Compressor, mds::mod::CMemoryChannel, mds::mod::CGZipCompressor, mds::mod::CDensityCompressor, and mds::mod::CRLE8Compressor.
void mds::mod::CChannel::separate | ( | const std::string & | sDescs, |
std::vector< std::string > & | Descs | ||
) | [static] |
Parses a given string and separates descriptions of several channels.
bool mds::mod::CChannel::skip | ( | int | iLength | ) | [virtual] |
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::CChannel::wait | ( | unsigned | uTimeout = CH_WAIT_TIMEOUT | ) | [pure virtual] |
Waits for data.
Implemented in mds::mod::CSharedMemChannel, mds::mod::CPipeChannel, mds::mod::CFileChannelU, mds::mod::CFileChannel, mds::mod::CStdChannel, mds::mod::CNullChannel, mds::mod::CChannelCompressor, mds::mod::CPredictorChannel, mds::mod::CBlockChannel, and mds::mod::CMemoryChannel.
virtual bool mds::mod::CChannel::write | ( | const char * | pcData, |
int | iLength | ||
) | [pure virtual] |
Writes data to the output channel.
Implemented in mds::mod::CSharedMemChannel, mds::mod::CPipeChannel, mds::mod::CFileChannelU, mds::mod::CFileChannel, mds::mod::CStdChannel, mds::mod::CNullChannel, mds::mod::CDensityPredictor, mds::mod::CRawCompressor, mds::mod::CByteTranspose< T >, mds::mod::CChannelCompressor, mds::mod::CPredictorChannel, mds::mod::CBlockChannel, mds::mod::CMemoryChannel, mds::mod::CRLE16Compressor, mds::mod::CGZipCompressor, mds::mod::CDensityCompressor, and mds::mod::CRLE8Compressor.
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] |
Channel medium.
int mds::mod::CChannel::m_Type [protected] |
Channel type.