Medical Imaging Interaction Toolkit  2023.12.99-ed252ae7
Medical Imaging Interaction Toolkit
berry::WeakPointer Class Reference

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

#include <berrySmartPointer.h>

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

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

typedef TObjectType berry::WeakPointer::ObjectType

Definition at line 41 of file berryWeakPointer.h.

Constructor & Destructor Documentation

◆ WeakPointer() [1/4]

berry::WeakPointer::WeakPointer ( )
inline

Default Constructor

Definition at line 44 of file berryWeakPointer.h.

◆ WeakPointer() [2/4]

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

Constructor

Definition at line 52 of file berryWeakPointer.h.

◆ WeakPointer() [3/4]

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

constructor

Definition at line 64 of file berryWeakPointer.h.

◆ WeakPointer() [4/4]

berry::WeakPointer::WeakPointer ( const WeakPointer p)
inline

Copy constructor

Definition at line 73 of file berryWeakPointer.h.

◆ ~ WeakPointer()

berry::WeakPointer::~ WeakPointer ( )
inline

Destructor

Definition at line 167 of file berryWeakPointer.h.

Member Function Documentation

◆ Expired()

bool berry::WeakPointer::Expired ( ) const
inline

Definition at line 161 of file berryWeakPointer.h.

◆ Lock()

SmartPointer<ObjectType> berry::WeakPointer::Lock ( ) const
inline

lock method is used to access the referring object

Definition at line 146 of file berryWeakPointer.h.

Referenced by qHash().

◆ operator<()

bool berry::WeakPointer::operator< ( const WeakPointer r) const
inline

Comparison of pointers. Less than comparison.

Definition at line 140 of file berryWeakPointer.h.

◆ operator=() [1/3]

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

Definition at line 82 of file berryWeakPointer.h.

References berry::SmartPointer::GetPointer().

◆ operator=() [2/3]

WeakPointer& berry::WeakPointer::operator= ( const WeakPointer other)
inline

Definition at line 96 of file berryWeakPointer.h.

◆ operator=() [3/3]

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

Definition at line 111 of file berryWeakPointer.h.

◆ operator==() [1/2]

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

Template comparison operators.

Definition at line 127 of file berryWeakPointer.h.

◆ operator==() [2/2]

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

Definition at line 133 of file berryWeakPointer.h.

◆ Reset()

void berry::WeakPointer::Reset ( )
inline

Definition at line 152 of file berryWeakPointer.h.


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