VTK
|
a weak reference to a vtkObject. More...
#include <vtkWeakPointer.h>
Public Member Functions | |
vtkWeakPointer () | |
vtkWeakPointer (T *r) | |
vtkWeakPointer (const vtkWeakPointerBase &r) | |
vtkWeakPointer & | operator= (T *r) |
vtkWeakPointer & | operator= (const vtkWeakPointerBase &r) |
T * | GetPointer () const |
operator T * () const | |
T & | operator* () const |
T * | operator-> () const |
Protected Member Functions | |
vtkWeakPointer (T *r, const NoReference &n) |
a weak reference to a vtkObject.
A weak reference to a vtkObject, which means that assigning a vtkObject to the vtkWeakPointer does not affect the reference count of the vtkObject. However, when the vtkObject is destroyed, the vtkWeakPointer gets initialized to NULL, thus avoiding any dangling references.
vtkTable *table = vtkTable::New(); vtkWeakPointer<vtkTable> weakTable = table;
Some time later the table may be deleted, but if it is tested for null then the weak pointer will not leave a dangling pointer.
table->Delete(); if (weakTable) { // Never executed as the weak table pointer will be null here cout << "Number of columns in table: " << weakTable->GetNumberOfColumns() << endl; }
Definition at line 51 of file vtkWeakPointer.h.
vtkWeakPointer< T >::vtkWeakPointer | ( | ) | [inline] |
Initialize smart pointer to NULL.
Definition at line 55 of file vtkWeakPointer.h.
vtkWeakPointer< T >::vtkWeakPointer | ( | T * | r | ) | [inline] |
Initialize smart pointer to given object.
Definition at line 58 of file vtkWeakPointer.h.
vtkWeakPointer< T >::vtkWeakPointer | ( | const vtkWeakPointerBase & | r | ) | [inline] |
Initialize smart pointer with the given smart pointer.
Definition at line 61 of file vtkWeakPointer.h.
vtkWeakPointer< T >::vtkWeakPointer | ( | T * | r, |
const NoReference & | n | ||
) | [inline, protected] |
Definition at line 137 of file vtkWeakPointer.h.
vtkWeakPointer& vtkWeakPointer< T >::operator= | ( | T * | r | ) | [inline] |
Assign object to reference.
Definition at line 65 of file vtkWeakPointer.h.
vtkWeakPointer& vtkWeakPointer< T >::operator= | ( | const vtkWeakPointerBase & | r | ) | [inline] |
Assign object to reference.
Reimplemented from vtkWeakPointerBase.
Definition at line 74 of file vtkWeakPointer.h.
T* vtkWeakPointer< T >::GetPointer | ( | ) | const [inline] |
Get the contained pointer.
Reimplemented from vtkWeakPointerBase.
Definition at line 83 of file vtkWeakPointer.h.
vtkWeakPointer< T >::operator T * | ( | ) | const [inline] |
Get the contained pointer.
Definition at line 91 of file vtkWeakPointer.h.
T& vtkWeakPointer< T >::operator* | ( | ) | const [inline] |
Dereference the pointer and return a reference to the contained object.
Definition at line 100 of file vtkWeakPointer.h.
T* vtkWeakPointer< T >::operator-> | ( | ) | const [inline] |
Provides normal pointer target member access using operator ->.
Definition at line 108 of file vtkWeakPointer.h.