Medical Imaging Interaction Toolkit  2018.4.99-f51274ea
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 32 of file berrySmartPointer.h.

Member Typedef Documentation

◆ ObjectType

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

Definition at line 41 of file berryWeakPointer.h.

Constructor & Destructor Documentation

◆ WeakPointer() [1/4]

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

Default Constructor

Definition at line 44 of file berryWeakPointer.h.

◆ WeakPointer() [2/4]

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

Constructor

Definition at line 52 of file berryWeakPointer.h.

◆ WeakPointer() [3/4]

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

constructor

Definition at line 64 of file berryWeakPointer.h.

◆ WeakPointer() [4/4]

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

Copy constructor

Definition at line 73 of file berryWeakPointer.h.

◆ ~ WeakPointer()

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

Destructor

Definition at line 167 of file berryWeakPointer.h.

Member Function Documentation

◆ Expired()

◆ Lock()

◆ operator<()

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

Comparison of pointers. Less than comparison.

Definition at line 140 of file berryWeakPointer.h.

◆ operator=() [1/3]

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

Definition at line 82 of file berryWeakPointer.h.

◆ operator=() [2/3]

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

Definition at line 96 of file berryWeakPointer.h.

◆ operator=() [3/3]

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

Definition at line 111 of file berryWeakPointer.h.

◆ operator==() [1/2]

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

Template comparison operators.

Definition at line 127 of file berryWeakPointer.h.

◆ operator==() [2/2]

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

Definition at line 133 of file berryWeakPointer.h.

◆ Reset()

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

Definition at line 152 of file berryWeakPointer.h.


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