Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berry::WeakPointer< TObjectType > Class Template Reference

implements a WeakPointer class to deal with circular reference problems. More...

#include <berrySmartPointer.h>

Inheritance diagram for berry::WeakPointer< TObjectType >:

Public Types

typedef TObjectType ObjectType
 

Public Member Functions

 WeakPointer ()
 
template<class Other >
 WeakPointer (berry::SmartPointer< Other > sptr)
 
template<class Other >
 WeakPointer (const WeakPointer< Other > &p)
 
 WeakPointer (const WeakPointer &p)
 
template<class Other >
WeakPointeroperator= (const SmartPointer< Other > &r)
 
WeakPointeroperator= (const WeakPointer &other)
 
template<class Other >
WeakPointeroperator= (const WeakPointer< Other > &other)
 
template<typename R >
bool operator== (const R *o) const
 
template<typename R >
bool operator== (const WeakPointer< R > &r) const
 
bool operator< (const WeakPointer &r) const
 
SmartPointer< ObjectTypeLock () const
 
void Reset ()
 
bool Expired () const
 
 ~WeakPointer ()
 

Detailed Description

template<class TObjectType>
class berry::WeakPointer< TObjectType >

implements a WeakPointer class to deal with circular reference problems.

The WeakPointer class implements smart pointer semantics without increasing the reference count. It registers itself at the Object it points to in order to get notified of its destruction and sets its internal pointer to 0. To be able to access an object through a weak pointer, you either use SmartPointer(const WeakPointer&) or the WeakPointer::Lock() method. The first approach throws a BadWeakPointerException if the object has been destroyed, the second returns an empty SmartPointer.

Definition at line 36 of file berrySmartPointer.h.

Member Typedef Documentation

template<class TObjectType>
typedef TObjectType berry::WeakPointer< TObjectType >::ObjectType

Definition at line 45 of file berryWeakPointer.h.

Constructor & Destructor Documentation

template<class TObjectType>
berry::WeakPointer< TObjectType >::WeakPointer ( )
inline

Default Constructor

Definition at line 48 of file berryWeakPointer.h.

template<class TObjectType>
template<class Other >
berry::WeakPointer< TObjectType >::WeakPointer ( berry::SmartPointer< Other >  sptr)
inlineexplicit

Constructor

Definition at line 56 of file berryWeakPointer.h.

template<class TObjectType>
template<class Other >
berry::WeakPointer< TObjectType >::WeakPointer ( const WeakPointer< Other > &  p)
inline

constructor

Definition at line 68 of file berryWeakPointer.h.

template<class TObjectType>
berry::WeakPointer< TObjectType >::WeakPointer ( const WeakPointer< TObjectType > &  p)
inline

Copy constructor

Definition at line 77 of file berryWeakPointer.h.

template<class TObjectType>
berry::WeakPointer< TObjectType >::~WeakPointer ( )
inline

Destructor

Definition at line 171 of file berryWeakPointer.h.

Member Function Documentation

template<class TObjectType>
bool berry::WeakPointer< TObjectType >::Expired ( ) const
inline
template<class TObjectType>
SmartPointer<ObjectType> berry::WeakPointer< TObjectType >::Lock ( ) const
inline
template<class TObjectType>
bool berry::WeakPointer< TObjectType >::operator< ( const WeakPointer< TObjectType > &  r) const
inline

Comparison of pointers. Less than comparison.

Definition at line 144 of file berryWeakPointer.h.

template<class TObjectType>
template<class Other >
WeakPointer& berry::WeakPointer< TObjectType >::operator= ( const SmartPointer< Other > &  r)
inline

Definition at line 86 of file berryWeakPointer.h.

template<class TObjectType>
WeakPointer& berry::WeakPointer< TObjectType >::operator= ( const WeakPointer< TObjectType > &  other)
inline

Definition at line 100 of file berryWeakPointer.h.

template<class TObjectType>
template<class Other >
WeakPointer& berry::WeakPointer< TObjectType >::operator= ( const WeakPointer< Other > &  other)
inline

Definition at line 115 of file berryWeakPointer.h.

template<class TObjectType>
template<typename R >
bool berry::WeakPointer< TObjectType >::operator== ( const R *  o) const
inline

Template comparison operators.

Definition at line 131 of file berryWeakPointer.h.

template<class TObjectType>
template<typename R >
bool berry::WeakPointer< TObjectType >::operator== ( const WeakPointer< R > &  r) const
inline

Definition at line 137 of file berryWeakPointer.h.

template<class TObjectType>
void berry::WeakPointer< TObjectType >::Reset ( void  )
inline

Definition at line 156 of file berryWeakPointer.h.


The documentation for this class was generated from the following files: