MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
mds::base::CLog Class Reference

Class implementing logging interface. More...

#include <mdsLog.h>

Inheritance diagram for mds::base::CLog:
Inheritance graph
[legend]

List of all members.

Public Types

enum  { SIZE = 512 }
 Size of the buffer. More...
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 CLibraryLockableClass
< CLog >::CLock 
tLock
 Lock type.

Public Member Functions

 CLog (bool bEnable=true)
 Default constructor.
void disable ()
 Disables the logging.
void enable (bool bEnable=true)
 Enables/disables the logging.
int getReferencesCount () const
 Returns the number of references.
std::ostream & getStream ()
 Returns the output stream.
bool isOnHeap () const
 Returns true if the object is allocated on the heap.
 MDS_SHAREDPTR (CLog)
 Smart pointer type.
virtual int overflow (int c=EOF)
 Implementation of virtual functions (std::streambuf).
void registerChannel (CLogChannel *pLogChannel)
 Registers a given output channel.
void removeAllChannels ()
 Removes all registered channels.
virtual int sync ()
virtual int underflow ()
void unregisterChannel (CLogChannel *pLogChannel)
 Unregisters a specified logging channel.
virtual ~CLog ()
 Virtual destructor.

Static Public Member Functions

static void lock ()
 Locks the object.
static void * operator new (std::size_t Size)
 Allocates a new object on the heap.
static void unlock ()
 Locks the object.

Protected Types

typedef std::set< CLogChannelPtrtChannels
 Set of all registered logging channels.

Protected Member Functions

void addReference () const
 Increase the reference counter.
bool delReference () const
 Decrease the reference counter.

Protected Attributes

bool m_bEnabled
 Flag used to disable/enable logging.
tChannels m_Channels
 Set of all registered logging channels.
int m_iHeapObject
 Flag initialized if the object is on the heap.
int m_iReferences
 The number of references to the object.
char m_pcBuffer [SIZE]
 Log buffer.
char * m_pcBufferEnd
 Pointer to the buffer end.
CScopedPtr< std::ostream > m_pStream
 Output stream.

Detailed Description

Class implementing logging interface.


Member Typedef Documentation

typedef std::set<CLogChannelPtr> mds::base::CLog::tChannels [protected]

Set of all registered logging channels.

Lock type.


Member Enumeration Documentation

anonymous enum

Size of the buffer.

Enumerator:
SIZE 
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

mds::base::CLog::CLog ( bool  bEnable = true)

Default constructor.

mds::base::CLog::~CLog ( ) [virtual]

Virtual destructor.


Member Function Documentation

void mds::base::CObject::addReference ( ) const [protected, inherited]

Increase the reference counter.

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.

Disables the logging.

void mds::base::CLog::enable ( bool  bEnable = true)

Enables/disables the logging.

Returns the number of references.

std::ostream& mds::base::CLog::getStream ( )

Returns the output stream.

bool mds::base::CObject::isOnHeap ( ) const [inherited]

Returns true if the object is allocated on the heap.

static void mds::base::CLockableClass< CLog >::lock ( ) [static, inherited]

Locks the object.

Smart pointer type.

  • Declares type tSmartPtr.
static void* mds::base::CObject::operator new ( std::size_t  Size) [static, inherited]

Allocates a new object on the heap.

int mds::base::CLog::overflow ( int  c = EOF) [virtual]

Implementation of virtual functions (std::streambuf).

Registers a given output channel.

Removes all registered channels.

int mds::base::CLog::sync ( ) [virtual]
static void mds::base::CLockableClass< CLog >::unlock ( ) [static, inherited]

Locks the object.

Unregisters a specified logging channel.


Member Data Documentation

bool mds::base::CLog::m_bEnabled [protected]

Flag used to disable/enable logging.

Set of all registered logging channels.

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.
char mds::base::CLog::m_pcBuffer[SIZE] [protected]

Log buffer.

char* mds::base::CLog::m_pcBufferEnd [protected]

Pointer to the buffer end.

CScopedPtr<std::ostream> mds::base::CLog::m_pStream [protected]

Output stream.


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