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

Base class providing intrusive reference counting model. More...

#include <mdsObject.h>

Inheritance diagram for mds::base::CObject:
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...

Public Member Functions

int getReferencesCount () const
 Returns the number of references.
bool isOnHeap () const
 Returns true if the object is allocated on the heap.
virtual ~CObject ()
 Destructor.

Static Public Member Functions

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

Protected Member Functions

void addReference () const
 Increase the reference counter.
 CObject ()
 Protected default constructor.
 CObject (const CObject &)
 Protected copy constructor.
bool delReference () const
 Decrease the reference counter.
CObjectoperator= (const CObject &)
 Protected assignment operator.

Protected Attributes

int m_iHeapObject
 Flag initialized if the object is on the heap.
int m_iReferences
 The number of references to the object.

Detailed Description

Base class providing intrusive reference counting model.


Member Enumeration Documentation

anonymous enum

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

Enumerator:
CLASS_OBJECT 
anonymous enum

Signature used to recognize objects on the heap.

Enumerator:
HEAP_OBJECT 

Constructor & Destructor Documentation

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

Destructor.

mds::base::CObject::CObject ( ) [protected]

Protected default constructor.

  • If the object is created statically, initialize the references counter to one, otherwise to zero.
mds::base::CObject::CObject ( const CObject ) [protected]

Protected copy constructor.


Member Function Documentation

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

Increase the reference counter.

bool mds::base::CObject::delReference ( ) const [protected]

Decrease the reference counter.

  • Returns true if the decremented number of references is lower or equal to zero and object must be deleted.

Returns the number of references.

Returns true if the object is allocated on the heap.

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

Allocates a new object on the heap.

CObject& mds::base::CObject::operator= ( const CObject ) [protected]

Protected assignment operator.


Member Data Documentation

int mds::base::CObject::m_iHeapObject [mutable, protected]

Flag initialized if the object is on the heap.

int mds::base::CObject::m_iReferences [mutable, protected]

The number of references to the object.

  • Zero if there is no reference.

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