VTK
vtkSmartPyObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSmartPyObject.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
21 #ifndef _vtkSmartPyObject_h
22 #define _vtkSmartPyObject_h
23 
24 // this must be included first
25 #include "vtkPython.h" // PyObject can't be forward declared
26 
27 #include "vtkWrappingPythonCoreModule.h"
28 
29 class VTKWRAPPINGPYTHONCORE_EXPORT vtkSmartPyObject {
30 public:
33  vtkSmartPyObject(PyObject *obj = NULL);
36  vtkSmartPyObject(const vtkSmartPyObject &other);
39 
43  vtkSmartPyObject& operator=(const vtkSmartPyObject &other);
47  vtkSmartPyObject& operator=(PyObject *obj);
50  void TakeReference(PyObject* obj);
51 
53  PyObject *operator->() const;
55  operator PyObject*() const;
56 
58  operator bool() const;
59 
60 
65  PyObject* ReleaseReference();
68  PyObject *GetPointer() const;
70 
72  PyObject* GetAndIncreaseReferenceCount();
73 private:
74  PyObject *Object;
75 };
77 
78 #endif
struct _object PyObject