ALBA
|
#include <albaReferenceCounted.h>
Public Member Functions | |
albaReferenceCounted () | |
virtual | ~albaReferenceCounted () |
albaAbstractTypeMacro (albaReferenceCounted, albaObject) | |
virtual void | Delete () |
void | Register (void *obj) |
virtual void | UnRegister (void *obj) |
int | GetReferenceCount () |
void | SetReferenceCount (int) |
Public Member Functions inherited from albaObject | |
albaObject () | |
virtual | ~albaObject () |
virtual void | Delete () |
virtual const char * | GetTypeName () const |
virtual bool | IsA (const char *type_name) const |
virtual bool | IsA (const albaTypeID &type_id) const |
virtual albaObject * | NewObjectInstance () const =0 |
virtual const albaTypeID & | GetTypeId () const |
virtual void | Print (std::ostream &os, const int indent=0) const |
albaObject (const albaObject &c) | |
Protected Attributes | |
int | m_ReferenceCount |
Protected Attributes inherited from albaObject | |
bool | m_HeapFlag |
Additional Inherited Members | |
Static Public Member Functions inherited from albaObject | |
static const char * | GetStaticTypeName () |
static bool | IsStaticType (const char *type_name) |
static bool | IsStaticType (const albaTypeID &type_id) |
static const albaTypeID & | GetStaticTypeId () |
static albaObject * | SafeDownCast (albaObject *o) |
albaReferenceCounted - abstract base class for ALBA objects with reference counting.
albaReferenceCounted is the base class for all reference counted classes in the ALBA. albaReferenceCounteds are also albaObjects, thus implementing all RTTI APIs. albaReferenceCounted performs reference counting: objects that are reference counted exist as long as another object uses them. Once the last reference to a reference counted object is removed, the object will spontaneously destruct.
Reference counting works only if the object is allocated dynamically with the New() static function, in all other cases trying to use Register/UnRegister simply throws an error. When allocated with New, the object should also be deallocated with Delete() or UnRegister().
Definition at line 34 of file albaReferenceCounted.h.
albaReferenceCounted::albaReferenceCounted | ( | ) |
|
virtual |
albaReferenceCounted::albaAbstractTypeMacro | ( | albaReferenceCounted | , |
albaObject | |||
) |
|
virtual |
Delete a ALBA object.
This method should be used to delete an object when the New() method was used to create it. Using the C++ delete method will not work with reference counting. This is the same as UnRegister(NULL)
Reimplemented from albaObject.
void albaReferenceCounted::Register | ( | void * | obj | ) |
Increase the reference count (mark as used by another object).
|
virtual |
|
inline |
Return the current reference count of this object.
Definition at line 59 of file albaReferenceCounted.h.
void albaReferenceCounted::SetReferenceCount | ( | int | ) |
Sets the reference count.
(This is very dangerous, use with care.)
|
protected |
Number of uses of this object by other objects.
Definition at line 65 of file albaReferenceCounted.h.