VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkSmartPyObject.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 00021 #ifndef _vtkSmartPyObject_h 00022 #define _vtkSmartPyObject_h 00023 00024 // this must be included first 00025 #include "vtkPython.h" // PyObject can't be forward declared 00026 00027 #include "vtkWrappingPythonCoreModule.h" 00028 00029 class VTKWRAPPINGPYTHONCORE_EXPORT vtkSmartPyObject { 00030 public: 00033 vtkSmartPyObject(PyObject *obj = NULL); 00036 vtkSmartPyObject(const vtkSmartPyObject &other); 00038 ~vtkSmartPyObject(); 00039 00043 vtkSmartPyObject& operator=(const vtkSmartPyObject &other); 00047 vtkSmartPyObject& operator=(PyObject *obj); 00050 void TakeReference(PyObject* obj); 00051 00053 PyObject *operator->() const; 00055 operator PyObject*() const; 00056 00058 operator bool() const; 00059 00060 00065 PyObject* ReleaseReference(); 00068 PyObject *GetPointer() const; 00070 00072 PyObject* GetAndIncreaseReferenceCount(); 00073 private: 00074 PyObject *Object; 00075 }; 00077 00078 #endif