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

Implements a weak reference to an object. More...

#include <mitkWeakPointer.h>

Inheritance diagram for mitk::WeakPointer< TObjectType >:
Collaboration diagram for mitk::WeakPointer< TObjectType >:

Public Types

typedef TObjectType ObjectType
 
typedef Message1< const itk::Object * > itkObjectEvent
 

Public Member Functions

 WeakPointer ()
 
 WeakPointer (const WeakPointer< ObjectType > &p)
 
 WeakPointer (ObjectType *p)
 
 ~WeakPointer ()
 
ObjectTypeoperator-> () const
 
 operator ObjectType * () const
 
template<typename R >
bool operator== (R r) const
 
template<typename R >
bool operator!= (R r) const
 
ObjectTypeGetPointer () const
 
bool operator< (const WeakPointer &r) const
 
bool operator> (const WeakPointer &r) const
 
bool operator<= (const WeakPointer &r) const
 
bool operator>= (const WeakPointer &r) const
 
bool IsNotNull () const
 
bool IsNull () const
 
WeakPointeroperator= (const WeakPointer &r)
 
WeakPointeroperator= (ObjectType *r)
 
ObjectTypePrint (std::ostream &os) const
 
void OnObjectDelete (const itk::Object *caller, const itk::EventObject &)
 Gets called when the object is deleted or modified. More...
 
void OnObjectModified (const itk::Object *caller, const itk::EventObject &)
 

Public Attributes

itkObjectEvent ObjectDelete
 AddEvent is emitted when the object pointed to gets deleted. More...
 
itkObjectEvent ObjectModified
 AddEvent is emitted when the object pointed to gets modified. More...
 

Detailed Description

template<class TObjectType>
class mitk::WeakPointer< TObjectType >

Implements a weak reference to an object.

Extends the standard itk WeakPointer by listening to delete events of itk::Objects. When an itk::Object is deleted the WeakPointer sets its internal Pointer to 0. This enables checking against 0 and avoids crashes by accessing changed memory. Furthermore it dispatches Modified events with the mitkMessageDelegate system which is much easier to use.

Definition at line 38 of file mitkWeakPointer.h.

Member Typedef Documentation

template<class TObjectType>
typedef Message1<const itk::Object *> mitk::WeakPointer< TObjectType >::itkObjectEvent

Definition at line 44 of file mitkWeakPointer.h.

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

Extract infoirmation from template parameter.

Definition at line 42 of file mitkWeakPointer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 54 of file mitkWeakPointer.h.

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

Copy constructor.

Definition at line 56 of file mitkWeakPointer.h.

template<class TObjectType>
mitk::WeakPointer< TObjectType >::WeakPointer ( ObjectType p)
inline

Constructor to pointer p.

Definition at line 63 of file mitkWeakPointer.h.

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

Destructor.

Definition at line 69 of file mitkWeakPointer.h.

Member Function Documentation

template<class TObjectType>
void mitk::WeakPointer< TObjectType >::OnObjectDelete ( const itk::Object *  caller,
const itk::EventObject &   
)
inline

Gets called when the object is deleted or modified.

Definition at line 127 of file mitkWeakPointer.h.

template<class TObjectType>
void mitk::WeakPointer< TObjectType >::OnObjectModified ( const itk::Object *  caller,
const itk::EventObject &   
)
inline

Definition at line 139 of file mitkWeakPointer.h.

template<class TObjectType>
mitk::WeakPointer< TObjectType >::operator ObjectType * ( ) const
inline

Return pointer to object.

Definition at line 79 of file mitkWeakPointer.h.

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

Definition at line 87 of file mitkWeakPointer.h.

template<class TObjectType>
ObjectType* mitk::WeakPointer< TObjectType >::operator-> ( ) const
inline

Overload operator ->.

Definition at line 77 of file mitkWeakPointer.h.

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

Comparison of pointers. Less than comparison.

Definition at line 95 of file mitkWeakPointer.h.

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

Comparison of pointers. Less than or equal to comparison.

Definition at line 99 of file mitkWeakPointer.h.

template<class TObjectType>
WeakPointer& mitk::WeakPointer< TObjectType >::operator= ( const WeakPointer< TObjectType > &  r)
inline

Overload operator assignment.

Definition at line 106 of file mitkWeakPointer.h.

Referenced by mitk::WeakPointer< mitk::DataInteractor >::operator=().

template<class TObjectType>
WeakPointer& mitk::WeakPointer< TObjectType >::operator= ( ObjectType r)
inline

Overload operator assignment.

Definition at line 108 of file mitkWeakPointer.h.

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

Template comparison operators.

Definition at line 82 of file mitkWeakPointer.h.

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

Comparison of pointers. Greater than comparison.

Definition at line 97 of file mitkWeakPointer.h.

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

Comparison of pointers. Greater than or equal to comparison.

Definition at line 101 of file mitkWeakPointer.h.

template<class TObjectType>
ObjectType* mitk::WeakPointer< TObjectType >::Print ( std::ostream &  os) const
inline

Function to print object pointed to.

Definition at line 117 of file mitkWeakPointer.h.

Member Data Documentation

template<class TObjectType>
itkObjectEvent mitk::WeakPointer< TObjectType >::ObjectDelete

AddEvent is emitted when the object pointed to gets deleted.

Definition at line 47 of file mitkWeakPointer.h.

Referenced by QmitkDataStorageTreeModel::SetDataStorage(), QmitkPointListViewWidget::SetPointSet(), and QmitkPropertiesTableModel::SetPropertyList().

template<class TObjectType>
itkObjectEvent mitk::WeakPointer< TObjectType >::ObjectModified

AddEvent is emitted when the object pointed to gets modified.

Definition at line 51 of file mitkWeakPointer.h.

Referenced by QmitkPointListViewWidget::SetPointSet().


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