TMCCountedObject Class Reference
[MCCore]

Inheritance diagram for TMCCountedObject:
IMCUnknown TBasicMenuCallBack TBasicPreviewThread TBasicThread TImportFileData TMCGaussianRandom TSimpleHierarchyItem< T >

List of all members.

Public Member Functions

void * operator new (MCSize byteCount) throw ()
void operator delete (void *block)
void * operator new[] (MCSize byteCount) throw ()
void operator delete[] (void *block)
virtual MCErr MCCOMAPI QueryInterface (const MCIID &riid, void **ppvObj)
virtual uint32 MCCOMAPI AddRef ()
virtual uint32 MCCOMAPI Release ()

Static Public Member Functions

static void Create (TMCCountedObject **outObject)

Protected Member Functions

 TMCCountedObject (void)
virtual ~TMCCountedObject ()

Protected Attributes

uint32 fRefCount

Detailed Description

Counted objects are objects that use a counter to keep track of how many other objects need them, and delete themselves when nobody needs them anymore. A counted object has an AddRef method that increments its counter, and a Release method that decrements it. When the value of the counter reaches zero, the object is deleted.

Take a look at TMCCountedCreateHelper to see how to create and return a counted object

Note:
If your object can be accessed by two threads at the same time, you ought to derive it from TMCSMPCountedObject (it uses an atomic counter).

Constructor & Destructor Documentation

TMCCountedObject::TMCCountedObject ( void   )  [protected]
virtual TMCCountedObject::~TMCCountedObject (  )  [protected, virtual]

Member Function Documentation

uint32 TMCCountedObject::AddRef (  )  [inline, virtual]

Increments the reference count of the object

Implements IMCUnknown.

Reimplemented in TBasicMenuCallBack, TBasicPreviewThread, TImportFileData, TBasicThread, and TSimpleHierarchyItem< T >.

static void TMCCountedObject::Create ( TMCCountedObject **  outObject  )  [static]
void TMCCountedObject::operator delete ( void *  block  ) 
void TMCCountedObject::operator delete[] ( void *  block  ) 
void* TMCCountedObject::operator new ( MCSize  byteCount  )  throw ()
void* TMCCountedObject::operator new[] ( MCSize  byteCount  )  throw ()
virtual MCErr MCCOMAPI TMCCountedObject::QueryInterface ( const MCIID riid,
void **  ppvObj 
) [virtual]

Check if the object supports a given interface and returns a pointer to that interface if it does. Note that QueryInterface will increment the reference count of the object by one if the interface is found.

Parameters:
riid GUID of the interface
ppvObj A pointer to the pointer being returned.

Implements IMCUnknown.

Reimplemented in TBasicMenuCallBack, TBasicPreviewThread, TImportFileData, TBasicThread, and TSimpleHierarchyItem< T >.

uint32 TMCCountedObject::Release (  )  [inline, virtual]

Decrements the reference count of the object. If the reference count reaches zero, the object is destroyed.

Implements IMCUnknown.

Reimplemented in TBasicMenuCallBack, TBasicPreviewThread, TImportFileData, TBasicThread, and TSimpleHierarchyItem< T >.


Member Data Documentation


The documentation for this class was generated from the following file:
Generated on Mon Apr 26 22:48:02 2010 for Carrara SDK Doc by  doxygen 1.6.3