VTK
Public Member Functions | List of all members
vtkSmartPyObject Class Reference

#include <vtkSmartPyObject.h>

Public Member Functions

 vtkSmartPyObject (PyObject *obj=NULL)
 
 vtkSmartPyObject (const vtkSmartPyObject &other)
 
 ~vtkSmartPyObject ()
 
vtkSmartPyObject & operator= (const vtkSmartPyObject &other)
 
vtkSmartPyObject & operator= (PyObject *obj)
 
void TakeReference (PyObject *obj)
 
PyObject * operator-> () const
 
 operator PyObject * () const
 
 operator bool () const
 
PyObject * ReleaseReference ()
 
PyObject * GetPointer () const
 
PyObject * GetAndIncreaseReferenceCount ()
 

Detailed Description

The vtkSmartPyObject class serves as a smart pointer for PyObjects.

Definition at line 29 of file vtkSmartPyObject.h.

Constructor & Destructor Documentation

◆ vtkSmartPyObject() [1/2]

vtkSmartPyObject::vtkSmartPyObject ( PyObject *  obj = NULL)

Creates a new vtkSmartPyObject managing the existing reference to the object given

◆ vtkSmartPyObject() [2/2]

vtkSmartPyObject::vtkSmartPyObject ( const vtkSmartPyObject &  other)

Creates a new vtkSmartPyObject to the object in the other smart pointer and increments the reference count to the object

◆ ~vtkSmartPyObject()

vtkSmartPyObject::~vtkSmartPyObject ( )

Decrements the reference count to the object

Member Function Documentation

◆ operator=() [1/2]

vtkSmartPyObject& vtkSmartPyObject::operator= ( const vtkSmartPyObject &  other)

The internal pointer is copied from the other vtkSmartPyObject. The reference count on the old object is decremented and the reference count on the new object is incremented

◆ operator=() [2/2]

vtkSmartPyObject& vtkSmartPyObject::operator= ( PyObject *  obj)

Sets the internal pointer to the given PyObject. The reference count on the PyObject is incremented. To take a reference without incrementing the reference count use TakeReference.

◆ TakeReference()

void vtkSmartPyObject::TakeReference ( PyObject *  obj)

Sets the internal pointer to the given PyObject without incrementing the reference count

◆ operator->()

PyObject* vtkSmartPyObject::operator-> ( ) const

Provides normal pointer target member access using operator ->.

◆ operator PyObject *()

vtkSmartPyObject::operator PyObject * ( ) const

Get the contained pointer.

◆ operator bool()

vtkSmartPyObject::operator bool ( ) const

Returns true if the internal pointer is to a valid PyObject.

◆ ReleaseReference()

PyObject* vtkSmartPyObject::ReleaseReference ( )

Returns the pointer to a PyObject stored internally and clears the internally stored pointer. The caller is responsible for calling Py_DECREF on the returned object when finished with it as this does not change the reference count.

◆ GetPointer()

PyObject* vtkSmartPyObject::GetPointer ( ) const

Returns the internal pointer to a PyObject with no effect on its reference count

◆ GetAndIncreaseReferenceCount()

PyObject* vtkSmartPyObject::GetAndIncreaseReferenceCount ( )

Returns the internal pointer to a PyObject and incrments its reference count


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