MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
mds::mod::CByteTranspose< T > Class Template Reference

Class providing a simple transposition of lower and higher bytes. More...

#include <mdsPredictor.h>

Inheritance diagram for mds::mod::CByteTranspose< T >:
Inheritance graph
[legend]

List of all members.

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.
typedef T tValue
 Input value.

Public Member Functions

 CByteTranspose (CChannel *pChannel=NULL)
 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.).
CChannelgetChannel ()
 Returns pointer to the underlying channel.
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 (CPredictorChannel)
 Smart pointer type.
 MDS_SHAREDPTR (CChannel)
 Smart pointer type.
 MDS_SHAREDPTR (CByteTranspose)
 Smart pointer type.
virtual int read (char *data, int length)
 Reads data from underlying channel and transposes them.
virtual void setChannel (CChannel *pChannel)
 Sets the underlying 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)
 Transposes data and writes them to underlying channel.
virtual ~CByteTranspose ()
 Virtual destructor.

Static Public Member Functions

static CChannelcreate (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

mds::base::CData< char > m_Buffer
 Internal buffer.
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.
CChannelPtr m_spChannel
 Underlying channel.
int m_Type
 Channel type.

Detailed Description

template<typename T>
class mds::mod::CByteTranspose< T >

Class providing a simple transposition of lower and higher bytes.

Such transposition may increase compress rate of a simple 8-bit RLE.


Member Typedef Documentation

Lock that have to be used to provide mutual access to write(), read() and etc.

functions.

template<typename T >
typedef T mds::mod::CByteTranspose< T >::tValue

Input value.


Member Enumeration Documentation

anonymous enum [inherited]

Templates that require members of the CObject class can use this enum to check the existence.

Enumerator:
CLASS_OBJECT 
anonymous enum [inherited]

Signature used to recognize objects on the heap.

Enumerator:
HEAP_OBJECT 

Constructor & Destructor Documentation

template<typename T >
mds::mod::CByteTranspose< T >::CByteTranspose ( CChannel pChannel = NULL)

Default constructor.

template<typename T >
virtual mds::mod::CByteTranspose< T >::~CByteTranspose ( ) [virtual]

Virtual destructor.


Member Function Documentation

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::CPredictorChannel::connect ( unsigned  uTimeout = CH_CONNECTION_TIMEOUT) [virtual, inherited]

Connects to the opposite channel side.

  • Returns false on failure and/or timeout elapsed.

Implements mds::mod::CChannel.

CChannel * mds::mod::CChannel::create ( EChannelType  eType,
const std::string &  sDesc 
) [static, inherited]

Creation of a channel which is described by a textual string.

  • String has the form: "chmedium[:chattrib1[:chattrib2[:...]]]".
  • Actually, the channel medium can be "stdio", "file", "pipe" and "shm".
  • Channel attributes depend on the medium.
  • "stdio" has empty attributes, "file" (:filename), "pipe" (:pipename) and "shm" (:shmname).
  • Throws CCannotCreate exception on failure!
bool mds::base::CObject::delReference ( ) const [protected, inherited]

Decrease the reference counter.

  • Returns true if the decremented number of references is lower or equal to zero and object must be deleted.
virtual void mds::mod::CPredictorChannel::disconnect ( ) [virtual, inherited]

Disconnects from the opossite channel side.

Implements mds::mod::CChannel.

virtual bool mds::mod::CPredictorChannel::flush ( ) [virtual, inherited]

Finalizes all writing operations (flushes internal buffers, etc.).

Implements mds::mod::CChannel.

Returns pointer to the underlying channel.

int mds::mod::CChannel::getMedium ( ) const [inherited]

Returns the channel medium.

Returns the number of references.

int mds::mod::CChannel::getType ( ) const [inherited]

Method returns the channel type.

virtual bool mds::mod::CPredictorChannel::isConnected ( ) [virtual, inherited]

Method for testing channel errors such as:

  • Disconnected or broken channel.
  • Reading after end of input.

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::CPredictorChannel::listen ( unsigned  uTimeout = CH_CONNECTION_TIMEOUT) [virtual, inherited]

Listens for the opposite channel side.

  • Returns false on failure and/or timeout elapsed.

Implements mds::mod::CChannel.

void mds::base::CLockableObject< CChannel >::lock ( ) [inherited]

Locks the object.

Smart pointer type.

Smart pointer type.

template<typename T >
mds::mod::CByteTranspose< T >::MDS_SHAREDPTR ( CByteTranspose< T >  )

Smart pointer type.

static void* mds::base::CObject::operator new ( std::size_t  Size) [static, inherited]

Allocates a new object on the heap.

template<typename T >
int CByteTranspose::read ( char *  data,
int  length 
) [virtual]

Reads data from underlying channel and transposes them.

Implements mds::mod::CPredictorChannel.

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.

  • Channels are separated by two successive colons "::" in the string.
  • Example: "chmedium1[:chattribs1][::chmedium2[:chattribs2][::...]]".
virtual void mds::mod::CPredictorChannel::setChannel ( CChannel pChannel) [virtual, inherited]

Sets the underlying channel.

bool mds::mod::CChannel::skip ( int  iLength) [virtual, inherited]

Skips a given number of bytes.

  • If the channel is open for readinpg, the data are discarded. Otherwise, zeros are written to the output channel.
  • This method cannot be used if the channel is opened for reading and writting simultaneously!

Reimplemented in mds::mod::CSharedMemChannel, and mds::mod::CMemoryChannel.

void mds::base::CLockableObject< CChannel >::unlock ( ) [inherited]

Locks the object.

virtual bool mds::mod::CPredictorChannel::wait ( unsigned  uTimeout = CH_WAIT_TIMEOUT) [virtual, inherited]

Waits for data.

  • Returns false if a timeout elapses and/or the channel is not input.

Implements mds::mod::CChannel.

template<typename T >
bool CByteTranspose::write ( const char *  data,
int  length 
) [virtual]

Transposes data and writes them to underlying channel.

Implements mds::mod::CPredictorChannel.


Member Data Documentation

template<typename T >
mds::base::CData<char> mds::mod::CByteTranspose< T >::m_Buffer [protected]

Internal buffer.

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.

  • Zero if there is no reference.
int mds::mod::CChannel::m_Medium [protected, inherited]

Channel medium.

Underlying channel.

int mds::mod::CChannel::m_Type [protected, inherited]

Channel type.


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