#include <smartptr.h>
Inheritance diagram for ParentPtr:
Public Member Functions | |
ParentPtr () | |
Construct a parent pointer that points to nothing. | |
ParentPtr (SmartPtr< T > ptr) | |
Construct a parent pointer from a smart pointer. | |
ParentPtr (IRefCount< T > *ptr) | |
Construct a parent pointer to an object. | |
ParentPtr (const ParentPtr &rhs) | |
Copy construct. | |
~ParentPtr () | |
Destructor clears the pointer without decrementing the count. | |
ParentPtr & | operator= (const SmartPtr< T > &sp) |
Set value from a smart pointer. | |
ParentPtr & | operator= (const ParentPtr< T > &sp) |
Set value from a parent pointer. | |
ParentPtr & | operator= (T *Ptr) |
Set value from a pointer. | |
void | Clear (void) |
Clear the recorded value of this pointer. | |
void | ClearFromParent (void) |
Clear the recorded value of this pointer. | |
Protected Member Functions | |
virtual void | __Assign (IRefCount< T > *refcount) |
Assign a 'smart' object to this pointer. |
If ObjectA has a smart pointer to ObjectB it shares ownership of it (and so ObjectA is a parent of ObjectB). A child may not hold a smart pointer to a parent (or grand-parent etc.) otherwise a loop will be formed and these objects will never be deleted. Child objects may reference parents using ParentPtr.
ParentPtr | ( | ) | [inline] |
Construct a parent pointer that points to nothing.
~ParentPtr | ( | ) | [inline] |
Destructor clears the pointer without decrementing the count.
virtual void __Assign | ( | IRefCount< T > * | refcount | ) | [inline, protected, virtual] |
Assign a 'smart' object to this pointer.
Note that no reference counting is performed with this version. This prevents circular references keeping objects for ever.
Reimplemented from SmartPtr.
ParentPtr& operator= | ( | T * | Ptr | ) | [inline] |
Set value from a pointer.
void Clear | ( | void | ) | [inline] |
Clear the recorded value of this pointer.
void ClearFromParent | ( | void | ) | [inline] |
Clear the recorded value of this pointer.
This call does not remove us from the parent's list of parent pointers (called by the parent)