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

Base class for all serializers. More...

#include <mdsSerializer.h>

Inheritance diagram for mds::mod::CChannelSerializer< S >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef mds::base::CFunctor
< bool, int, int
tProgressFunc
 Progress observer (= functor).
typedef CProgressInitializer tProgressInitializer
 Helper class which can be used to call methods beginProgress() and endProgress() automatically.
typedef S tSerializer
 Serializer type.

Public Member Functions

CHasOptionsaddOption (int Flag)
 Adds a given flag using bitwise OR operation.
void beginProgress ()
 This function must be called by the class realizing an operation before it starts.
template<typename T >
void beginRead (T &Object)
 Reads information on logical group of class members from the serialized data.
template<typename T >
void beginWrite (T &Object)
 Creates a new logical group of class members in the serialized data.
bool checkAllOptions (int Flags) const
 Checks if all specified flags are set.
bool checkAnyOption (int Flags) const
 Checks if any of specified flags is set.
int checkOption (int Flag) const
 Checks if a single flag is set.
CHasOptionsclearOption (int Flag)
 Removes a given flag.
void deregisterProgressFunc ()
 Sets the default empty observer.
void endProgress ()
 The function must be called by the class realizing an operation every time the operation finishes.
template<typename T >
void endRead (T &Object)
 Reads end of the logical group.
template<typename T >
void endWrite (T &Object)
 End of the logical group.
CChannelgetChannelPtr ()
 Returns pointer to the I/O channel.
tSerializergetImpl ()
 Returns reference to the serializer implementation.
const tSerializergetImpl () const
int getOptions () const
 Returns all flags.
int getProgressCount () const
 Returns current value of the internal progress value.
int getProgressMax () const
 Returns the maximum allowed value of the internal progress counter.
bool progress (int iIncrement=1)
 Calls the registered observer.
template<typename T >
void read (T &Value)
 Deserializes a given fundamental value.
template<typename T >
void read (T *pData, tSize Length)
 Deserializes a given block of data.
template<typename T >
void readRoot (T &Object)
 Deserializes a given data entity.
void registerProgressFunc (const tProgressFunc &Func)
 Sets observer/functor called to inform a calling process about the current state of the running operation.
void setChannel (CChannel *pChannel)
 Sets the I/O channel.
CHasOptionssetOption (int Flag)
 Adds a given flag using bitwise OR operation.
CHasOptionssetOptions (int Flags)
 Sets complete flags.
void setProgressMax (int iValue)
 Sets the maximal counter value.
template<typename T >
void write (const T &Value)
 Serializes a given fundamental value.
template<typename T >
void write (const T *pData, tSize Length)
 Serializes a given block of data.
template<typename T >
void writeRoot (T &Object)
 Serializes a given data entity.
 ~CChannelSerializer ()
 Destructor.

Protected Member Functions

 CChannelSerializer (CChannel *pChannel, int iFlags=0)
 Hidden constructor.
 CChannelSerializer (const CChannelSerializer &Serializer)
 Hidden copy constructor.
CChannelSerializeroperator= (const CChannelSerializer &Serializer)
 Hidden assignment operator.

Protected Attributes

int m_Options
 Optional flags.
CChannelPtr m_spChannel
 Pointer to the I/O channel.

Detailed Description

template<class S>
class mds::mod::CChannelSerializer< S >

Base class for all serializers.


Member Typedef Documentation

Progress observer (= functor).

  • You may return false from the observer if you want to terminate the running operation.
  • Parameters describe current and final state of the pending operation (counter and maximal value).
  • If the second parameter is equal to -1, termination time cannot be determined, the current state is unknown.

Helper class which can be used to call methods beginProgress() and endProgress() automatically.

Create static object of this type at the begining of a method that realizes an operation.

template<class S>
typedef S mds::mod::CChannelSerializer< S >::tSerializer

Serializer type.


Constructor & Destructor Documentation

template<class S>
mds::mod::CChannelSerializer< S >::~CChannelSerializer ( )

Destructor.

template<class S>
mds::mod::CChannelSerializer< S >::CChannelSerializer ( CChannel pChannel,
int  iFlags = 0 
) [protected]

Hidden constructor.

template<class S>
mds::mod::CChannelSerializer< S >::CChannelSerializer ( const CChannelSerializer< S > &  Serializer) [protected]

Hidden copy constructor.


Member Function Documentation

Adds a given flag using bitwise OR operation.

void mds::mod::CProgress::beginProgress ( ) [inherited]

This function must be called by the class realizing an operation before it starts.

template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::beginRead ( T &  Object)

Reads information on logical group of class members from the serialized data.

  • Must be called before any read() method.
  • Throws exception on failure.

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CSHMSerializer, and mds::mod::CBinarySerializer.

template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::beginWrite ( T &  Object)

Creates a new logical group of class members in the serialized data.

  • Properties of the group, such as compression method, are chosen according to the serialization traits.
  • Must be called before any write() method.
  • Throws exception on failure.

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CBinarySerializer, and mds::mod::CSHMSerializer.

bool mds::base::CHasOptions::checkAllOptions ( int  Flags) const [inherited]

Checks if all specified flags are set.

bool mds::base::CHasOptions::checkAnyOption ( int  Flags) const [inherited]

Checks if any of specified flags is set.

int mds::base::CHasOptions::checkOption ( int  Flag) const [inherited]

Checks if a single flag is set.

  • Returns zero on false.

Removes a given flag.

Sets the default empty observer.

void mds::mod::CProgress::endProgress ( ) [inherited]

The function must be called by the class realizing an operation every time the operation finishes.

  • Sets the default observer.
template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::endRead ( T &  Object)

Reads end of the logical group.

  • Throws exception on failure.

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CSHMSerializer, and mds::mod::CBinarySerializer.

template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::endWrite ( T &  Object)

End of the logical group.

  • Throws exception on failure.

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CBinarySerializer, and mds::mod::CSHMSerializer.

template<class S>
CChannel* mds::mod::CChannelSerializer< S >::getChannelPtr ( )

Returns pointer to the I/O channel.

template<class S>
tSerializer& mds::mod::CChannelSerializer< S >::getImpl ( )

Returns reference to the serializer implementation.

template<class S>
const tSerializer& mds::mod::CChannelSerializer< S >::getImpl ( ) const
int mds::base::CHasOptions::getOptions ( ) const [inherited]

Returns all flags.

Returns current value of the internal progress value.

Returns the maximum allowed value of the internal progress counter.

template<class S>
CChannelSerializer& mds::mod::CChannelSerializer< S >::operator= ( const CChannelSerializer< S > &  Serializer) [protected]

Hidden assignment operator.

bool mds::mod::CProgress::progress ( int  iIncrement = 1) [inherited]

Calls the registered observer.

  • Returns false if the running operation should be terminated as soon as possible.
  • It must be called periodically by the class realizing the operation.
template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::read ( T &  Value)

Deserializes a given fundamental value.

  • Throws exception on failure.
  • Derived classes have to implement this method!

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CSHMSerializer, and mds::mod::CBinarySerializer.

template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::read ( T *  pData,
tSize  Length 
)

Deserializes a given block of data.

  • Throws exception on failure.
  • Derived classes have to implement this method!

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CSHMSerializer, and mds::mod::CBinarySerializer.

template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::readRoot ( T &  Object)

Deserializes a given data entity.

  • Throws exception on failure.
  • Derived classes have to implement this method!

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CSHMSerializer, and mds::mod::CBinarySerializer.

void mds::mod::CProgress::registerProgressFunc ( const tProgressFunc Func) [inherited]

Sets observer/functor called to inform a calling process about the current state of the running operation.

  • This function should be called before any operation starts.
template<class S>
void mds::mod::CChannelSerializer< S >::setChannel ( CChannel pChannel)

Sets the I/O channel.

Adds a given flag using bitwise OR operation.

Sets complete flags.

void mds::mod::CProgress::setProgressMax ( int  iValue) [inherited]

Sets the maximal counter value.

template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::write ( const T &  Value)

Serializes a given fundamental value.

  • Throws exception on failure.
  • Derived classes have to implement this method!

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CSHMSerializer, and mds::mod::CBinarySerializer.

template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::write ( const T *  pData,
tSize  Length 
)

Serializes a given block of data.

  • Throws exception on failure.
  • Derived classes have to implement this method!

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CSHMSerializer, and mds::mod::CBinarySerializer.

template<class S>
template<typename T >
void mds::mod::CChannelSerializer< S >::writeRoot ( T &  Object)

Serializes a given data entity.

  • Throws exception on failure.
  • Derived classes have to implement this method!

Reimplemented in mds::mod::CSHMSerializer, mds::mod::CBinarySerializer, mds::mod::CSHMSerializer, and mds::mod::CBinarySerializer.


Member Data Documentation

int mds::base::CHasOptions::m_Options [protected, inherited]

Optional flags.

template<class S>
CChannelPtr mds::mod::CChannelSerializer< S >::m_spChannel [protected]

Pointer to the I/O channel.


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