ParentPtr Class Template Reference

Parent pointer class - used to allow an object referenced by another object to make a returrn reference without forming a loop. More...

#include <smartptr.h>

Inheritance diagram for ParentPtr:

SmartPtr MDObjectParent PackageParent PartitionParent TrackParent List of all members.

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.
ParentPtroperator= (const SmartPtr< T > &sp)
 Set value from a smart pointer.
ParentPtroperator= (const ParentPtr< T > &sp)
 Set value from a parent pointer.
ParentPtroperator= (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.

Detailed Description

template<class T>
class mxflib::ParentPtr< T >

Parent pointer class - used to allow an object referenced by another object to make a returrn reference without forming a loop.

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.


Constructor & Destructor Documentation

ParentPtr (  )  [inline]

Construct a parent pointer that points to nothing.

ParentPtr ( SmartPtr< T >  ptr  )  [inline]

Construct a parent pointer from a smart pointer.

ParentPtr ( IRefCount< T > *  ptr  )  [inline]

Construct a parent pointer to an object.

ParentPtr ( const ParentPtr< T > &  rhs  )  [inline]

Copy construct.

~ParentPtr (  )  [inline]

Destructor clears the pointer without decrementing the count.


Member Function Documentation

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= ( const SmartPtr< T > &  sp  )  [inline]

Set value from a smart pointer.

Reimplemented from SmartPtr.

ParentPtr& operator= ( const ParentPtr< T > &  sp  )  [inline]

Set value from a parent pointer.

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)


The documentation for this class was generated from the following file:
Generated on Mon Apr 2 15:21:02 2007 for MXFLib by  doxygen 1.5.1-p1