Main Page   Namespace List   Class Hierarchy   Compound List   Compound Members  

ZThread::AutoPtr Class Template Reference

#include <AutoPtr.h>

List of all members.

Public Methods

 AutoPtr () throw ()
 AutoPtr (COUNTED *pImpl) throw ()
 AutoPtr (const AutoPtr &ptr) throw ()
 ~AutoPtr () throw ()
AutoPtr& operator= (const AutoPtr &ptr) throw ()
COUNTED* operator-> () throw ()
const COUNTED* operator-> () const throw ()


Detailed Description

template<class COUNTED, class MUTEX = FastMutex> class ZThread::AutoPtr

Author:
Eric Crahen
Version:
1.4.4
Date:
07-05-2001

Thread-safe wrapper to implement a counted reference.

This is a class wide lock. In otherwords, all AutoPtr<MyClass> objects are locked with the same Mutex no matter how many actual MyClass implementations are being used.

Implementation level locking would be possible to implement - but would not be practical for a large number of objects.

Its recommended that use the AutoPtr() default constructor to avoid accidental double assignment & deletion errors.


Constructor & Destructor Documentation

AutoPtr ( ) throw () [inline]
 

Create a new COUNTED reference from the default constructor

AutoPtr ( COUNTED * pImpl ) throw () [inline]
 

Create a new AutoPtr from an existing COUNTED reference

The use of this constructor is really discouraged. Possible candidate for deprecation. The absence of this method would allow for a streamlined way to lock at implementation level rather than class level - However, for a large number of implementations this will not be practical. So class level locking is used for now

Parameters:
pImpl  

AutoPtr ( const AutoPtr<COUNTED, MUTEX> & ptr ) throw () [inline]
 

Create a new AutoPtr from another AutoPtr

Parameters:
ptr  

~AutoPtr ( ) throw () [inline]
 

Destroy the AutoPtr and check for release of the implementation


Member Function Documentation

const COUNTED * operator-> ( ) const throw () [inline]
 

Get a reference to the underlying implementation

COUNTED * operator-> ( ) throw () [inline]
 

Get a reference to the underlying implementation

AutoPtr & operator= ( const AutoPtr<COUNTED, MUTEX> & ptr ) throw () [inline]
 

Assignment

Parameters:
ptr  


The documentation for this class was generated from the following file:
Generated at Fri Aug 31 09:07:59 2001 for ZThread by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001