VTK
Public Member Functions | Protected Member Functions

vtkSmartPointer< T > Class Template Reference

Hold a reference to a vtkObjectBase instance. More...

#include <vtkSmartPointer.h>

Inherits vtkSmartPointerBase.

Collaboration diagram for vtkSmartPointer< T >:
[legend]

List of all members.

Public Member Functions

 vtkSmartPointer ()
 vtkSmartPointer (T *r)
 vtkSmartPointer (const vtkSmartPointerBase &r)
vtkSmartPointeroperator= (T *r)
vtkSmartPointeroperator= (const vtkSmartPointerBase &r)
T * GetPointer () const
 operator T * () const
T & operator* () const
T * operator-> () const
void TakeReference (T *t)

Static Public Member Functions

static vtkSmartPointer< T > New ()
static vtkSmartPointer< T > NewInstance (T *t)
static vtkSmartPointer< T > Take (T *t)

Protected Member Functions

 vtkSmartPointer (T *r, const NoReference &n)

Detailed Description

template<class T>
class vtkSmartPointer< T >

Hold a reference to a vtkObjectBase instance.

vtkSmartPointer is a class template that provides automatic casting for objects held by the vtkSmartPointerBase superclass.

Tests:
vtkSmartPointer (Tests)

Definition at line 32 of file vtkSmartPointer.h.


Constructor & Destructor Documentation

template<class T>
vtkSmartPointer< T >::vtkSmartPointer ( ) [inline]

Initialize smart pointer to NULL.

Definition at line 38 of file vtkSmartPointer.h.

template<class T>
vtkSmartPointer< T >::vtkSmartPointer ( T *  r) [inline]

Initialize smart pointer to given object.

Definition at line 41 of file vtkSmartPointer.h.

template<class T>
vtkSmartPointer< T >::vtkSmartPointer ( const vtkSmartPointerBase r) [inline]

Initialize smart pointer with a new reference to the same object referenced by given smart pointer.

Definition at line 52 of file vtkSmartPointer.h.

template<class T>
vtkSmartPointer< T >::vtkSmartPointer ( T *  r,
const NoReference n 
) [inline, protected]

Definition at line 185 of file vtkSmartPointer.h.


Member Function Documentation

template<class T>
vtkSmartPointer& vtkSmartPointer< T >::operator= ( T *  r) [inline]

Assign object to reference. This removes any reference to an old object.

Definition at line 58 of file vtkSmartPointer.h.

template<class T>
vtkSmartPointer& vtkSmartPointer< T >::operator= ( const vtkSmartPointerBase r) [inline]

Assign object to reference. This removes any reference to an old object.

Reimplemented from vtkSmartPointerBase.

Definition at line 77 of file vtkSmartPointer.h.

template<class T>
T* vtkSmartPointer< T >::GetPointer ( ) const [inline]

Get the contained pointer.

Reimplemented from vtkSmartPointerBase.

Definition at line 86 of file vtkSmartPointer.h.

template<class T>
vtkSmartPointer< T >::operator T * ( ) const [inline]

Get the contained pointer.

Definition at line 94 of file vtkSmartPointer.h.

template<class T>
T& vtkSmartPointer< T >::operator* ( ) const [inline]

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

Definition at line 103 of file vtkSmartPointer.h.

template<class T>
T* vtkSmartPointer< T >::operator-> ( ) const [inline]

Provides normal pointer target member access using operator ->.

Definition at line 111 of file vtkSmartPointer.h.

template<class T>
void vtkSmartPointer< T >::TakeReference ( T *  t) [inline]

Transfer ownership of one reference to the given VTK object to this smart pointer. This does not increment the reference count of the object, but will decrement it later. The caller is effectively passing ownership of one reference to the smart pointer. This is useful for code like: vtkSmartPointer<vtkFoo> foo; foo.TakeReference(bar->NewFoo()); The input argument may not be another smart pointer.

Definition at line 125 of file vtkSmartPointer.h.

template<class T>
static vtkSmartPointer<T> vtkSmartPointer< T >::New ( ) [inline, static]

Create an instance of a VTK object.

Definition at line 133 of file vtkSmartPointer.h.

template<class T>
static vtkSmartPointer<T> vtkSmartPointer< T >::NewInstance ( T *  t) [inline, static]

Create a new instance of the given VTK object.

Definition at line 141 of file vtkSmartPointer.h.

template<class T>
static vtkSmartPointer<T> vtkSmartPointer< T >::Take ( T *  t) [inline, static]

Transfer ownership of one reference to the given VTK object to a new smart pointer. The returned smart pointer does not increment the reference count of the object on construction but will decrement it on destruction. The caller is effectively passing ownership of one reference to the smart pointer. This is useful for code like: vtkSmartPointer<vtkFoo> foo = vtkSmartPointer<vtkFoo>::Take(bar->NewFoo()); The input argument may not be another smart pointer.

Definition at line 156 of file vtkSmartPointer.h.


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