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 () |
int32 | GetReferenceCount () |
Static Public Member Functions | |
static void | Create (TMCSMPCountedObject **outObject) |
Protected Member Functions | |
TMCSMPCountedObject () | |
virtual | ~TMCSMPCountedObject () |
Protected Attributes | |
TMCAtomicCounterHolder | fRefCountAC |
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
TMCSMPCountedObject::TMCSMPCountedObject | ( | ) | [protected] |
virtual TMCSMPCountedObject::~TMCSMPCountedObject | ( | ) | [protected, virtual] |
uint32 TMCSMPCountedObject::AddRef | ( | ) | [inline, virtual] |
Increments the reference count of the object
Implements IMCUnknown.
Reimplemented in TCountedTimeBased, TCountedRenderable, TCountedRenderingCallbacks, TBasicParamType, TBasicRemoteInstructions, TBasicSmpThread, and TMCSocket.
static void TMCSMPCountedObject::Create | ( | TMCSMPCountedObject ** | outObject | ) | [static] |
int32 TMCSMPCountedObject::GetReferenceCount | ( | ) | [inline] |
void TMCSMPCountedObject::operator delete | ( | void * | block | ) |
Reimplemented in TTimeBasedList, and TInstanceList.
void TMCSMPCountedObject::operator delete[] | ( | void * | block | ) |
Reimplemented in TTimeBasedList, and TInstanceList.
void* TMCSMPCountedObject::operator new | ( | MCSize | byteCount | ) | throw () |
Reimplemented in TTimeBasedList, and TInstanceList.
void* TMCSMPCountedObject::operator new[] | ( | MCSize | byteCount | ) | throw () |
Reimplemented in TTimeBasedList, and TInstanceList.
virtual MCErr MCCOMAPI TMCSMPCountedObject::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.
riid | GUID of the interface | |
ppvObj | A pointer to the pointer being returned. |
Implements IMCUnknown.
Reimplemented in TCountedTimeBased, TCountedRenderable, TCountedRenderingCallbacks, TBasicParamType, TBasicRemoteInstructions, TBasicSmpThread, and TMCSocket.
uint32 TMCSMPCountedObject::Release | ( | ) | [inline, virtual] |
Decrements the reference count of the object. If the reference count reaches zero, the object is destroyed.
Implements IMCUnknown.
Reimplemented in TCountedTimeBased, TCountedRenderable, TCountedRenderingCallbacks, TBasicParamType, TBasicRemoteInstructions, TBasicSmpThread, and TMCSocket.