WeakReference< RC > Class Template Reference

A weak reference is like a Reference, but the object disappears when there are no more real References on it. More...

#include <refcounter_decls.h>

Inheritance diagram for WeakReference< RC >:

WeakRefBase List of all members.

Public Member Functions

 WeakReference ()
 Constructs a WeakReference that will throw a NullPointerException when dereferenced.
 WeakReference (const WeakReference &other)
 Constructs a WeakReference by referencing the same object as another WeakReference other.
 WeakReference (const Reference< RC > &other)
 Constructs a WeakReference by referencing the same object as a "real" Reference other.
 WeakReference (RC *obj)
 Constructs a WeakReference by referencing given obj.
WeakReferenceoperator= (const WeakReference &other)
 The assignment operator is needed for reference counting.
WeakReferenceoperator= (const Reference< RC > &other)
 The assignment operator is needed for reference counting.
bool operator== (const WeakReference &other) const
 Checks whether this and other reference the same object.
bool operator== (const Reference< RC > &other) const
 Checks whether this and other reference the same object.
bool operator!= (const WeakReference &other) const
 Checks whether this and other reference the same object.
bool operator!= (const Reference< RC > &other) const
 Checks whether this and other reference the same object.
Reference< RC > operator * () const
 Returns the RefCounter derived object referenced.
 ~WeakReference ()
 This destructor is needed for reference counting.

Friends

class Reference< RC >

Detailed Description

template<class RC>
class WeakReference< RC >

A weak reference is like a Reference, but the object disappears when there are no more real References on it.


Constructor & Destructor Documentation

template<class RC>
WeakReference< RC >::WeakReference ( const WeakReference< RC > &  other  )  [inline]

Constructs a WeakReference by referencing the same object as another WeakReference other.

Parameters:
other contains the reference to copy

template<class RC>
WeakReference< RC >::WeakReference ( const Reference< RC > &  other  )  [inline]

Constructs a WeakReference by referencing the same object as a "real" Reference other.

Parameters:
other contains the reference to copy

template<class RC>
WeakReference< RC >::WeakReference ( RC *  obj  )  [inline]

Constructs a WeakReference by referencing given obj.

Note that there might not be "real" References so the referenced object might not be destroyed when this WeakReference dies.

Parameters:
obj is a pointer to the object to be referenced


Member Function Documentation

template<class RC>
WeakReference< RC > & WeakReference< RC >::operator= ( const WeakReference< RC > &  other  )  [inline]

The assignment operator is needed for reference counting.

Parameters:
other is contains the reference to copy
Returns:
*this

template<class RC>
WeakReference< RC > & WeakReference< RC >::operator= ( const Reference< RC > &  other  )  [inline]

The assignment operator is needed for reference counting.

Parameters:
other is contains the reference to copy
Returns:
*this

template<class RC>
bool WeakReference< RC >::operator== ( const WeakReference< RC > &  other  )  const [inline]

Checks whether this and other reference the same object.

Parameters:
other is the WeakReference to compare to
Returns:
true if the references are equal, false otherwise

template<class RC>
bool WeakReference< RC >::operator== ( const Reference< RC > &  other  )  const [inline]

Checks whether this and other reference the same object.

Parameters:
other is the Reference to compare to
Returns:
true if the references are equal, false otherwise

template<class RC>
bool WeakReference< RC >::operator!= ( const WeakReference< RC > &  other  )  const [inline]

Checks whether this and other reference the same object.

Parameters:
other is the WeakReference to compare to
Returns:
true if the references are differ, false otherwise

template<class RC>
bool WeakReference< RC >::operator!= ( const Reference< RC > &  other  )  const [inline]

Checks whether this and other reference the same object.

Parameters:
other is the Reference to compare to
Returns:
true if the references are differ, false otherwise

template<class RC>
Reference< RC > WeakReference< RC >::operator * (  )  const [inline]

Returns the RefCounter derived object referenced.

Returns:
the object referenced
Exceptions:
NullPointerException 


The documentation for this class was generated from the following files:
Generated on Sat Feb 7 01:26:51 2009 by  doxygen 1.5.1