#include <smartptr.h>
Inheritance diagram for RefCount:
Protected Types | |
typedef ParentPtr< T > | LocalParent |
Parent pointer to this type. | |
typedef std::list< LocalParent * > | LocalParentList |
List of pointers to parent pointers. | |
Protected Member Functions | |
virtual void | __IncRefCount () |
Increment the number of references. | |
virtual void | __DecRefCount () |
Decrement the number of references, if none left delete the object. | |
virtual T * | GetPtr () |
Get a pointer to the object. | |
virtual IRefCount< T > * | GetRef () |
Get a pointer to the object. | |
virtual void | __DestroyRef () |
Destroy the object. | |
virtual void | AddRef (ParentPtr< T > &Ptr) |
Add a parent pointer to this object. | |
virtual void | DeleteRef (ParentPtr< T > &Ptr) |
Delete a parent pointer to this object. | |
RefCount () | |
Constructor for the RefCount class. | |
virtual | ~RefCount () |
Clear all parent pointers when we are destroyed. | |
virtual void | ClearParents (void) |
Clear all parent pointers. | |
Protected Attributes | |
int | __m_counter |
The actual reference count. | |
LocalParentList * | ParentPointers |
List of parent pointers to this object. |
Classes derived from RefCount will contain their own reference counting implementation and allow more efficient memory use.
class MyClass : public RefCount<MyClass> {...};
typedef ParentPtr<T> LocalParent [protected] |
Parent pointer to this type.
typedef std::list<LocalParent*> LocalParentList [protected] |
List of pointers to parent pointers.
virtual ~RefCount | ( | ) | [inline, protected, virtual] |
Clear all parent pointers when we are destroyed.
virtual void __IncRefCount | ( | ) | [inline, protected, virtual] |
virtual void __DecRefCount | ( | ) | [inline, protected, virtual] |
virtual T* GetPtr | ( | ) | [inline, protected, virtual] |
virtual IRefCount<T>* GetRef | ( | ) | [inline, protected, virtual] |
virtual void __DestroyRef | ( | ) | [inline, protected, virtual] |
virtual void AddRef | ( | ParentPtr< T > & | Ptr | ) | [inline, protected, virtual] |
virtual void DeleteRef | ( | ParentPtr< T > & | Ptr | ) | [inline, protected, virtual] |
void ClearParents | ( | void | ) | [protected, virtual] |
int __m_counter [protected] |
The actual reference count.
LocalParentList* ParentPointers [protected] |
List of parent pointers to this object.