Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OS::GCPtr< T > Class Template Reference

#include <GCPtr.h>

Inheritance diagram for OS::GCPtr< T >:

Inheritance graph
[legend]
Collaboration diagram for OS::GCPtr< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GCPtr ()
 GCPtr (T *pointee)
 GCPtr (const GCPtr &other)
GCPtroperator= (const GCPtr &other)
GCPtroperator= (T *pointee)
 ~GCPtr ()
T & operator * () const
T * operator-> () const
bool isNull () const

Detailed Description

template<class T>
class OS::GCPtr< T >

A generic smart pointer that allows several references without copies that handles automatic deletion. It is a kind of smart pointer that allows an unlimited number of pointer to the same object with auto-deletion when all pointers are forgotten. The deletion takes place immediately when no pointer refers to the object any more. It does not run in independent cycles like a garbage collector. If the user wants an actual copy, an explicit copy of the object must be made through the copy constructor or a specialized clone function. This template has the following differences compared to the specialized SH::RPtr template:


Constructor & Destructor Documentation

template<class T>
OS::GCPtr< T >::GCPtr  )  [inline]
 

template<class T>
OS::GCPtr< T >::GCPtr T *  pointee  )  [inline, explicit]
 

This constructor swallows an externally provided pointer and consumes it. Since the number of copies maintained by this smart pointer is set to 1, deletion of this smart pointer will trigger a call to the release function of the pointee. This means that the pointer that is provided for constructing this object would become invalid at the latest when the last GCPtr is deleted. To make this slightly more deterministic, the pointee that is used for the construction of the smart pointer is deleted immediately.

template<class T>
OS::GCPtr< T >::GCPtr const GCPtr< T > &  other  )  [inline]
 

template<class T>
OS::GCPtr< T >::~GCPtr  )  [inline]
 


Member Function Documentation

template<class T>
bool OS::GCPtr< T >::isNull  )  const [inline]
 

template<class T>
T& OS::GCPtr< T >::operator *  )  const [inline]
 

template<class T>
T* OS::GCPtr< T >::operator->  )  const [inline]
 

template<class T>
GCPtr& OS::GCPtr< T >::operator= T *  pointee  )  [inline]
 

template<class T>
GCPtr& OS::GCPtr< T >::operator= const GCPtr< T > &  other  )  [inline]
 


The documentation for this class was generated from the following file:
Generated on Sun Mar 6 13:36:23 2005 for Komssys by doxygen 1.3.8