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

An atomic increment and decrement operation. More...

#include <mdsAtomic.h>

Inheritance diagram for mds::sys::CAtomic:
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

unsigned add (unsigned Value=1)
 Incrementes the value.
 CAtomic (unsigned Value=0)
 Constructor.
unsigned get ()
 Returns the current value.
int getReferencesCount () const
 Returns the number of references.
bool isOnHeap () const
 Returns true if the object is allocated on the heap.
 MDS_SHAREDPTR (CAtomic)
 Smart pointer type.
 operator unsigned ()
 Conversion to the integer (returns the current value).
unsigned operator++ ()
 Returns the incremented value.
unsigned operator-- ()
 Returns the decremented value.
unsigned set (unsigned Value)
 Changes the value.
unsigned sub (unsigned Value=1)
 Decrementes the value.
 ~CAtomic ()
 Standard 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.
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.

Detailed Description

An atomic increment and decrement operation.


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

mds::sys::CAtomic::CAtomic ( unsigned  Value = 0)

Constructor.

Standard destructor.


Member Function Documentation

unsigned mds::sys::CAtomic::add ( unsigned  Value = 1)

Incrementes the value.

  • Returns the previous value!
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.
unsigned mds::sys::CAtomic::get ( )

Returns the current value.

Returns the number of references.

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

Returns true if the object is allocated on the heap.

Smart pointer type.

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

Allocates a new object on the heap.

mds::sys::CAtomic::operator unsigned ( )

Conversion to the integer (returns the current value).

unsigned mds::sys::CAtomic::operator++ ( )

Returns the incremented value.

unsigned mds::sys::CAtomic::operator-- ( )

Returns the decremented value.

unsigned mds::sys::CAtomic::set ( unsigned  Value)

Changes the value.

  • Returns the previous value!
unsigned mds::sys::CAtomic::sub ( unsigned  Value = 1)

Decrementes the value.

  • Returns the previous value!

Member Data Documentation

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.

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