VTK  9.1.0
Public Member Functions | List of all members
vtkWeakPointer< T > Class Template Reference

a weak reference to a vtkObject. More...

#include <vtkWeakPointer.h>

Inheritance diagram for vtkWeakPointer< T >:
[legend]
Collaboration diagram for vtkWeakPointer< T >:
[legend]

Public Member Functions

 vtkWeakPointer () noexcept
 Initialize smart pointer to nullptr.
 
 vtkWeakPointer (const vtkWeakPointer &r)
 Initialize smart pointer with the given smart pointer.
 
template<class U >
 vtkWeakPointer (const vtkWeakPointer< U > &r)
 Initialize smart pointer with the given smart pointer.
 
 vtkWeakPointer (vtkWeakPointer &&r) noexcept
 Move r's object into the new weak pointer, setting r to nullptr.
 
template<class U >
 vtkWeakPointer (vtkWeakPointer< U > &&r) noexcept
 Initialize smart pointer with the given smart pointer.
 
 vtkWeakPointer (T *r)
 Initialize smart pointer to given object.
 
template<typename U >
 vtkWeakPointer (const vtkNew< U > &r)
 Initialize smart pointer with the given smart pointer.
 
vtkWeakPointeroperator= (const vtkWeakPointer &r)
 Assign object to reference.
 
template<class U >
vtkWeakPointeroperator= (const vtkWeakPointer< U > &r)
 Assign object to reference.
 
vtkWeakPointeroperator= (vtkWeakPointer &&r) noexcept
 Move r's object into this weak pointer, setting r to nullptr.
 
template<class U >
vtkWeakPointeroperator= (vtkWeakPointer< U > &&r) noexcept
 Move r's object into this weak pointer, setting r to nullptr.
 
vtkWeakPointeroperator= (T *r)
 Assign object to reference.
 
template<typename U >
vtkWeakPointeroperator= (const vtkNew< U > &r)
 Assign object to reference.
 
- Public Member Functions inherited from vtkWeakPointerBase
 vtkWeakPointerBase () noexcept
 Initialize smart pointer to nullptr.
 
 vtkWeakPointerBase (vtkObjectBase *r)
 Initialize smart pointer to given object.
 
 vtkWeakPointerBase (const vtkWeakPointerBase &r)
 Copy r's data object into the new weak pointer.
 
 vtkWeakPointerBase (vtkWeakPointerBase &&r) noexcept
 Move r's object into the new weak pointer, setting r to nullptr.
 
 ~vtkWeakPointerBase ()
 Destroy smart pointer.
 
vtkObjectBaseGetPointer () const
 Get the contained pointer.
 
vtkWeakPointerBaseoperator= (vtkObjectBase *r)
 Assign object to reference.
 
vtkWeakPointerBaseoperator= (const vtkWeakPointerBase &r)
 Assign object to reference.
 
vtkWeakPointerBaseoperator= (vtkWeakPointerBase &&r) noexcept
 Assign object to reference.
 
T * GetPointer () const noexcept
 Get the contained pointer.
 
T * Get () const noexcept
 Get the contained pointer.
 
 operator T* () const noexcept
 Get the contained pointer.
 
T & operator* () const noexcept
 Dereference the pointer and return a reference to the contained object.
 
T * operator-> () const noexcept
 Provides normal pointer target member access using operator ->.
 
 vtkWeakPointer (T *r, const NoReference &n)
 Get the contained pointer.
 

Additional Inherited Members

- Protected Member Functions inherited from vtkWeakPointerBase
 vtkWeakPointerBase (vtkObjectBase *r, const NoReference &)
 
- Protected Attributes inherited from vtkWeakPointerBase
vtkObjectBaseObject
 

Detailed Description

template<class T>
class vtkWeakPointer< T >

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 nullptr, thus avoiding any dangling references.

vtkWeakPointer<vtkTable> weakTable = table;
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:172
static vtkTable * New()
a weak reference to a vtkObject.

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;
}
virtual void Delete()
Delete a VTK object.

Definition at line 55 of file vtkWeakPointer.h.

Constructor & Destructor Documentation

◆ vtkWeakPointer() [1/8]

template<class T >
vtkWeakPointer< T >::vtkWeakPointer ( )
inlinenoexcept

Initialize smart pointer to nullptr.

Definition at line 82 of file vtkWeakPointer.h.

◆ vtkWeakPointer() [2/8]

template<class T >
vtkWeakPointer< T >::vtkWeakPointer ( const vtkWeakPointer< T > &  r)
inline

Initialize smart pointer with the given smart pointer.

Definition at line 91 of file vtkWeakPointer.h.

◆ vtkWeakPointer() [3/8]

template<class T >
template<class U >
vtkWeakPointer< T >::vtkWeakPointer ( const vtkWeakPointer< U > &  r)
inline

Initialize smart pointer with the given smart pointer.

Definition at line 97 of file vtkWeakPointer.h.

◆ vtkWeakPointer() [4/8]

template<class T >
vtkWeakPointer< T >::vtkWeakPointer ( vtkWeakPointer< T > &&  r)
inlinenoexcept

Move r's object into the new weak pointer, setting r to nullptr.

Definition at line 108 of file vtkWeakPointer.h.

◆ vtkWeakPointer() [5/8]

template<class T >
template<class U >
vtkWeakPointer< T >::vtkWeakPointer ( vtkWeakPointer< U > &&  r)
inlinenoexcept

Initialize smart pointer with the given smart pointer.

Definition at line 114 of file vtkWeakPointer.h.

◆ vtkWeakPointer() [6/8]

template<class T >
vtkWeakPointer< T >::vtkWeakPointer ( T *  r)
inline

Initialize smart pointer to given object.

Definition at line 125 of file vtkWeakPointer.h.

◆ vtkWeakPointer() [7/8]

template<class T >
template<typename U >
vtkWeakPointer< T >::vtkWeakPointer ( const vtkNew< U > &  r)
inline

Initialize smart pointer with the given smart pointer.

Definition at line 132 of file vtkWeakPointer.h.

◆ vtkWeakPointer() [8/8]

template<class T >
vtkWeakPointer< T >::vtkWeakPointer ( T *  r,
const NoReference n 
)
inlineprotected

Get the contained pointer.

Definition at line 243 of file vtkWeakPointer.h.

Member Function Documentation

◆ operator=() [1/6]

template<class T >
vtkWeakPointer & vtkWeakPointer< T >::operator= ( const vtkWeakPointer< T > &  r)
inline

Assign object to reference.

Definition at line 143 of file vtkWeakPointer.h.

◆ operator=() [2/6]

template<class T >
template<class U >
vtkWeakPointer & vtkWeakPointer< T >::operator= ( const vtkWeakPointer< U > &  r)
inline

Assign object to reference.

Definition at line 150 of file vtkWeakPointer.h.

◆ operator=() [3/6]

template<class T >
vtkWeakPointer & vtkWeakPointer< T >::operator= ( vtkWeakPointer< T > &&  r)
inlinenoexcept

Move r's object into this weak pointer, setting r to nullptr.

Definition at line 163 of file vtkWeakPointer.h.

◆ operator=() [4/6]

template<class T >
template<class U >
vtkWeakPointer & vtkWeakPointer< T >::operator= ( vtkWeakPointer< U > &&  r)
inlinenoexcept

Move r's object into this weak pointer, setting r to nullptr.

Definition at line 170 of file vtkWeakPointer.h.

◆ operator=() [5/6]

template<class T >
vtkWeakPointer & vtkWeakPointer< T >::operator= ( T *  r)
inline

Assign object to reference.

Definition at line 183 of file vtkWeakPointer.h.

◆ operator=() [6/6]

template<class T >
template<typename U >
vtkWeakPointer & vtkWeakPointer< T >::operator= ( const vtkNew< U > &  r)
inline

Assign object to reference.

Definition at line 191 of file vtkWeakPointer.h.

◆ GetPointer()

template<class T >
T * vtkWeakPointer< T >::GetPointer ( ) const
inlinenoexcept

Get the contained pointer.

Definition at line 204 of file vtkWeakPointer.h.

◆ Get()

template<class T >
T * vtkWeakPointer< T >::Get ( ) const
inlinenoexcept

Get the contained pointer.

Definition at line 205 of file vtkWeakPointer.h.

◆ operator T*()

template<class T >
vtkWeakPointer< T >::operator T* ( ) const
inlinenoexcept

Get the contained pointer.

Definition at line 206 of file vtkWeakPointer.h.

◆ operator*()

template<class T >
T & vtkWeakPointer< T >::operator* ( ) const
inlinenoexcept

Dereference the pointer and return a reference to the contained object.

Definition at line 212 of file vtkWeakPointer.h.

◆ operator->()

template<class T >
T * vtkWeakPointer< T >::operator-> ( ) const
inlinenoexcept

Provides normal pointer target member access using operator ->.

Definition at line 217 of file vtkWeakPointer.h.


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