VTK
vtkPythonArgs.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPythonArgs.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 /*-----------------------------------------------------------------------
16 The vtkPythonArgs class was created in Oct 2010 by David Gobbi for.
17 
18 This class provides methods for reading an argument tuple from Python
19 and converting it to types that can be used by VTK. It is meant to be
20 more efficient and flexible that the original PyArg_ParseTuple() code,
21 resulting in wrapper code that is faster and more compact.
22 -----------------------------------------------------------------------*/
23 
27 #ifndef vtkPythonArgs_h
28 #define vtkPythonArgs_h
29 
30 #include "vtkWrappingPythonCoreModule.h" // For export macro
31 #include "vtkPythonUtil.h"
32 #include "PyVTKObject.h"
33 #include "PyVTKTemplate.h"
34 
35 #include "vtkConfigure.h"
36 #include "vtkUnicodeString.h"
37 
38 #include <string>
39 
41 {
42 public:
43 
45 
46  vtkPythonArgs(PyObject *self, PyObject *args, const char *methodname) :
47  Args(args), MethodName(methodname) {
48  this->N = PyTuple_GET_SIZE(args);
49  this->M = PyType_Check(self);
50  this->I = this->M;
51  }
53 
55 
56  vtkPythonArgs(PyObject *args, const char *methodname) :
57  Args(args), MethodName(methodname) {
58  this->N = PyTuple_GET_SIZE(args);
59  this->M = 0;
60  this->I = 0;
61  }
63 
65  void Reset() { this->I = this->M; }
66 
70  static vtkObjectBase *GetSelfPointer(PyObject *self, PyObject *args);
71 
75  static void *GetSelfSpecialPointer(PyObject *self, PyObject *args);
76 
79  static void *GetSelfSpecialPointer(PyObject *self);
80 
82  bool CheckArgCount(int nmin, int nmax);
83 
85  bool CheckArgCount(int n);
86 
88  bool IsBound() { return (this->M == 0); }
89 
91  bool IsPureVirtual();
92 
94  static bool ErrorOccurred();
95 
97  bool NoArgsLeft() { return (this->I >= this->N); }
98 
102  int GetArgSize(int i);
103 
105 
107  bool b;
108  v = this->GetArgAsPythonObject(b);
109  return b; }
111  bool b;
113  return b; }
115 
117 
121  template<class T>
122  bool GetVTKObject(T *&v, const char *classname) {
123  bool b;
124  v = (T *)this->GetArgAsVTKObject(classname, b);
125  return b; }
126  template<class T>
127  bool GetVTKObject(PyObject *o, T *&v, const char *classname) {
128  bool b;
129  v = (T *)vtkPythonArgs::GetArgAsVTKObject(o, classname, b);
130  return b; }
132 
134 
137  template<class T>
138  bool GetSpecialObject(T *&v, PyObject *&o, const char *classname) {
139  v = static_cast<T *>(this->GetArgAsSpecialObject(classname, &o));
140  return (v != NULL); }
141  template<class T>
142  static bool GetSpecialObject(
143  PyObject *arg, T *&v, PyObject *&o, const char *classname) {
144  v = static_cast<T *>(
145  vtkPythonArgs::GetArgAsSpecialObject(arg, classname, &o));
146  return (v != NULL); }
148 
150 
152  template<class T>
153  bool GetSpecialObject(T *&v, const char *classname) {
154  v = static_cast<T *>(this->GetArgAsSpecialObject(classname, NULL));
155  return (v != NULL); }
156  template<class T>
157  static bool GetSpecialObject(PyObject *o, T *&v, const char *classname) {
158  v = static_cast<T *>(
159  vtkPythonArgs::GetArgAsSpecialObject(o, classname, NULL));
160  return (v != NULL); }
162 
164 
165  template<class T>
166  bool GetEnumValue(T &v, const char *enumname) {
167  bool r;
168  v = static_cast<T>(this->GetArgAsEnum(enumname, r));
169  return r; }
170  template<class T>
171  static bool GetEnumValue(PyObject *o, T &v, const char *enumname) {
172  bool r;
173  v = static_cast<T>(vtkPythonArgs::GetArgAsEnum(o, enumname, r));
174  return r; }
176 
178 
179  template<class T>
180  bool GetSIPObject(T *&v, const char *classname) {
181  bool r;
182  v = (T *)this->GetArgAsSIPObject(classname, r);
183  return r; }
184  template<class T>
185  static bool GetSIPObject(PyObject *o, T *&v, const char *classname) {
186  bool r;
187  v = (T *)vtkPythonArgs::GetArgAsSIPObject(o, classname, r);
188  return r; }
190 
192 
193  template<class T>
194  bool GetSIPEnumValue(T &v, const char *enumname) {
195  bool r;
196  v = static_cast<T>(this->GetArgAsSIPEnum(enumname, r));
197  return r; }
198  template<class T>
199  static bool GetSIPEnumValue(PyObject *o, T &v, const char *enumname) {
200  bool r;
201  v = static_cast<T>(vtkPythonArgs::GetArgAsSIPEnum(o, enumname, r));
202  return r; }
204 
206 
208  bool GetFunction(PyObject *&o);
209  static bool GetFunction(PyObject *arg, PyObject *&o);
211 
212  // Get the next arg as a void pointer (to a buffer object).
213  bool GetBuffer(void *&v, Py_buffer *buf);
214  static bool GetBuffer(PyObject *o, void *&v, Py_buffer *buf);
215  bool GetBuffer(const void *&v, Py_buffer *buf);
216  static bool GetBuffer(PyObject *o, const void *&v, Py_buffer *buf);
217 
219 
220  bool GetValue(const char *&v);
221  static bool GetValue(PyObject *o, const char *&v);
222  bool GetValue(char *&v);
223  static bool GetValue(PyObject *o, char *&v);
224  bool GetValue(std::string &v);
225  static bool GetValue(PyObject *o, std::string &v);
226  bool GetValue(vtkUnicodeString &v);
227  static bool GetValue(PyObject *o, vtkUnicodeString &v);
229 
231 
232  bool GetValue(char &v);
233  static bool GetValue(PyObject *o, char &v);
235 
237 
238  bool GetValue(float &v);
239  static bool GetValue(PyObject *o, float &v);
240  bool GetValue(double &v);
241  static bool GetValue(PyObject *o, double &v);
242  bool GetValue(bool &v);
243  static bool GetValue(PyObject *o, bool &v);
244  bool GetValue(signed char &v);
245  static bool GetValue(PyObject *o, signed char &v);
246  bool GetValue(unsigned char &v);
247  static bool GetValue(PyObject *o, unsigned char &v);
248  bool GetValue(short &v);
249  static bool GetValue(PyObject *o, short &v);
250  bool GetValue(unsigned short &v);
251  static bool GetValue(PyObject *o, unsigned short &v);
252  bool GetValue(int &v);
253  static bool GetValue(PyObject *o, int &v);
254  bool GetValue(unsigned int &v);
255  static bool GetValue(PyObject *o, unsigned int &v);
256  bool GetValue(long &v);
257  static bool GetValue(PyObject *o, long &v);
258  bool GetValue(unsigned long &v);
259  static bool GetValue(PyObject *o, unsigned long &v);
260  bool GetValue(long long &v);
261  static bool GetValue(PyObject *o, long long &v);
262  bool GetValue(unsigned long long &v);
263  static bool GetValue(PyObject *o, unsigned long long &v);
265 
267 
268  bool GetArray(float *v, int n);
269  bool GetArray(double *v, int n);
270  bool GetArray(bool *v, int n);
271  bool GetArray(char *v, int n);
272  bool GetArray(signed char *v, int n);
273  bool GetArray(unsigned char *v, int n);
274  bool GetArray(short *v, int n);
275  bool GetArray(unsigned short *v, int n);
276  bool GetArray(int *v, int n);
277  bool GetArray(unsigned int *v, int n);
278  bool GetArray(long *v, int n);
279  bool GetArray(unsigned long *v, int n);
280  bool GetArray(long long *v, int n);
281  bool GetArray(unsigned long long *v, int n);
283 
285 
286  bool GetNArray(float *v, int ndims, const int *dims);
287  bool GetNArray(double *v, int ndims, const int *dims);
288  bool GetNArray(bool *v, int ndims, const int *dims);
289  bool GetNArray(char *v, int ndims, const int *dims);
290  bool GetNArray(signed char *v, int ndims, const int *dims);
291  bool GetNArray(unsigned char *v, int ndims, const int *dims);
292  bool GetNArray(short *v, int ndims, const int *dims);
293  bool GetNArray(unsigned short *v, int ndims, const int *dims);
294  bool GetNArray(int *v, int ndims, const int *dims);
295  bool GetNArray(unsigned int *v, int ndims, const int *dims);
296  bool GetNArray(long *v, int ndims, const int *dims);
297  bool GetNArray(unsigned long *v, int ndims, const int *dims);
298  bool GetNArray(long long *v, int ndims, const int *dims);
299  bool GetNArray(unsigned long long *v, int ndims, const int *dims);
301 
303 
304  bool SetArgValue(int i, const std::string &v);
305  bool SetArgValue(int i, const vtkUnicodeString &v);
306  bool SetArgValue(int i, char v);
307  bool SetArgValue(int i, float v);
308  bool SetArgValue(int i, double v);
309  bool SetArgValue(int i, bool v);
310  bool SetArgValue(int i, signed char v);
311  bool SetArgValue(int i, unsigned char v);
312  bool SetArgValue(int i, short v);
313  bool SetArgValue(int i, unsigned short v);
314  bool SetArgValue(int i, int v);
315  bool SetArgValue(int i, unsigned int v);
316  bool SetArgValue(int i, long v);
317  bool SetArgValue(int i, unsigned long v);
318  bool SetArgValue(int i, long long v);
319  bool SetArgValue(int i, unsigned long long v);
321 
323 
324  bool SetArray(int i, const float *v, int n);
325  bool SetArray(int i, const double *v, int n);
326  bool SetArray(int i, const bool *v, int n);
327  bool SetArray(int i, const char *v, int n);
328  bool SetArray(int i, const signed char *v, int n);
329  bool SetArray(int i, const unsigned char *v, int n);
330  bool SetArray(int i, const short *v, int n);
331  bool SetArray(int i, const unsigned short *v, int n);
332  bool SetArray(int i, const int *v, int n);
333  bool SetArray(int i, const unsigned int *v, int n);
334  bool SetArray(int i, const long *v, int n);
335  bool SetArray(int i, const unsigned long *v, int n);
336  bool SetArray(int i, const long long *v, int n);
337  bool SetArray(int i, const unsigned long long *v, int n);
339 
341 
342  bool SetNArray(int i, const float *v, int n, const int *d);
343  bool SetNArray(int i, const double *v, int n, const int *d);
344  bool SetNArray(int i, const bool *v, int n, const int *d);
345  bool SetNArray(int i, const char *v, int n, const int *d);
346  bool SetNArray(int i, const signed char *v, int n, const int *d);
347  bool SetNArray(int i, const unsigned char *v, int n, const int *d);
348  bool SetNArray(int i, const short *v, int n, const int *d);
349  bool SetNArray(int i, const unsigned short *v, int n, const int *d);
350  bool SetNArray(int i, const int *v, int n, const int *d);
351  bool SetNArray(int i, const unsigned int *v, int n, const int *d);
352  bool SetNArray(int i, const long *v, int n, const int *d);
353  bool SetNArray(int i, const unsigned long *v, int n, const int *d);
354  bool SetNArray(int i, const long long *v, int n, const int *d);
355  bool SetNArray(int i, const unsigned long long *v, int n, const int *d);
357 
359  static PyObject *BuildNone();
360 
363  static PyObject *BuildVTKObject(const void *v);
364 
366  static PyObject *BuildSpecialObject(const void *v, const char *classname);
367 
369  static PyObject *BuildEnumValue(int v, const char *enumname);
370 
372 
374  static PyObject *BuildSIPObject(
375  const void *v, const char *classname, bool created);
377 
379  static PyObject *BuildSIPEnumValue(int v, const char *classname);
380 
382  static PyObject *BuildValue(const void *v);
383 
385 
386  static PyObject *BuildValue(const char *v, size_t l);
387  static PyObject *BuildValue(const char *v);
388  static PyObject *BuildValue(const std::string &v);
389  static PyObject *BuildValue(const vtkUnicodeString &v);
391 
393  static PyObject *BuildValue(char v);
394 
396 
397  static PyObject *BuildValue(double v);
398  static PyObject *BuildValue(bool v);
399  static PyObject *BuildValue(int v);
400  static PyObject *BuildValue(unsigned int v);
401  static PyObject *BuildValue(long v);
402  static PyObject *BuildValue(unsigned long v);
403  static PyObject *BuildValue(long long v);
404  static PyObject *BuildValue(unsigned long long v);
406 
408  static PyObject *BuildBytes(const char *v, int n);
409 
411 
412  static PyObject *BuildTuple(const float *v, int n);
413  static PyObject *BuildTuple(const double *v, int n);
414  static PyObject *BuildTuple(const bool *v, int n);
415  static PyObject *BuildTuple(const signed char *v, int n);
416  static PyObject *BuildTuple(const unsigned char *v, int n);
417  static PyObject *BuildTuple(const short *v, int n);
418  static PyObject *BuildTuple(const unsigned short *v, int n);
419  static PyObject *BuildTuple(const int *v, int n);
420  static PyObject *BuildTuple(const unsigned int *v, int n);
421  static PyObject *BuildTuple(const long *v, int n);
422  static PyObject *BuildTuple(const unsigned long *v, int n);
423  static PyObject *BuildTuple(const long long *v, int n);
424  static PyObject *BuildTuple(const unsigned long long *v, int n);
426 
428 
429  template<class T>
430  static void SaveArray(const T *a, T *b, int n) {
431  int i = 0;
432  do { b[i] = a[i]; } while (++i < n); }
434 
436 
437  template<class T>
438  static bool ArrayHasChanged(const T *a, const T *b, int n) {
439  int i = 0;
440  do { if (a[i] != b[i]) break; } while (++i < n);
441  return (i < n); }
443 
445 
446  static int GetArgCount(PyObject *args) {
447  return static_cast<int>(PyTuple_GET_SIZE(args)); }
449 
451 
452  static int GetArgCount(PyObject *self, PyObject *args) {
453  return (static_cast<int>(PyTuple_GET_SIZE(args)) -
454  PyType_Check(self)); }
456 
458  static bool ArgCountError(int n, const char *name);
459 
460 
461 protected:
462 
464  static PyObject *GetSelfFromFirstArg(PyObject *self, PyObject *args);
465 
467 
468  PyObject *GetArgAsPythonObject(bool &valid);
469  static PyObject *GetArgAsPythonObject(
470  PyObject *o, bool &valid);
472 
474 
475  vtkObjectBase *GetArgAsVTKObject(const char *classname, bool &valid);
476  static vtkObjectBase *GetArgAsVTKObject(
477  PyObject *o, const char *classname, bool &valid);
479 
481 
482  void *GetArgAsSpecialObject(const char *classname, PyObject **newobj);
483  static void *GetArgAsSpecialObject(
484  PyObject *o, const char *classname, PyObject **newobj);
486 
488 
489  int GetArgAsEnum(const char *enumname, bool &valid);
490  static int GetArgAsEnum(
491  PyObject *o, const char *enumname, bool &valid);
493 
495 
496  void *GetArgAsSIPObject(const char *classname, bool &valid);
497  static void *GetArgAsSIPObject(
498  PyObject *o, const char *classname, bool &valid);
500 
502 
503  int GetArgAsSIPEnum(const char *classname, bool &valid);
504  static int GetArgAsSIPEnum(
505  PyObject *o, const char *classname, bool &valid);
507 
509  bool PureVirtualError();
510 
512  bool ArgCountError(int m, int n);
513 
515  bool RefineArgTypeError(int i);
516 
517 private:
518 
519  PyObject *Args;
520  const char *MethodName;
521 
522  int N; // size of args tuple
523  int M; // 1 if Self is a PyVTKClass and first arg is the PyVTKObject
524  int I; // the arg counter, starts at M
525 };
526 
527 //--------------------------------------------------------------------
528 // Inline methods for getting "self" as its original type
529 
530 // Get "self" from a PyVTKObject, which contains a vtkObjectBase object.
531 inline
533 {
534  if (PyType_Check(self))
535  {
536  self = vtkPythonArgs::GetSelfFromFirstArg(self, args);
537  }
538  return (self ? ((PyVTKObject *)self)->vtk_ptr : NULL);
539 }
540 
541 // Get "self" from a PyVTKSpecialObject.
542 inline
544 {
545  if (PyType_Check(self))
546  {
547  self = vtkPythonArgs::GetSelfFromFirstArg(self, args);
548  }
549  return (self ? ((PyVTKSpecialObject *)self)->vtk_ptr : NULL);
550 }
551 
552 // Get "self" from a PyVTKSpecialObject (for methods with no args).
553 inline
555 {
556  return ((PyVTKSpecialObject *)self)->vtk_ptr;
557 }
558 
559 //--------------------------------------------------------------------
560 // Inline methods for checking the arg count
561 
562 // Verify the arg count for a method with optional arguments.
563 inline
564 bool vtkPythonArgs::CheckArgCount(int nmin, int nmax)
565 {
566  int nargs = this->N - this->M;
567  if (nargs >= nmin && nargs <= nmax)
568  {
569  return true;
570  }
571  this->ArgCountError(nmin, nmax);
572  return false;
573 }
574 
575 // Verify the arg count for a method with optional arguments.
576 inline
578 {
579  int nargs = this->N - this->M;
580  if (nargs == n)
581  {
582  return true;
583  }
584  this->ArgCountError(n, n);
585  return false;
586 }
587 
588 //--------------------------------------------------------------------
589 // Inline method for guarding against pure virtual method calls
590 
591 inline
593 {
594  if (IsBound())
595  {
596  return false;
597  }
598  this->PureVirtualError();
599  return true;
600 }
601 
602 //--------------------------------------------------------------------
603 // Inline method for checking if an error has occurred.
604 
605 inline
607 {
608  return (PyErr_Occurred() != NULL);
609 }
610 
611 //--------------------------------------------------------------------
612 // Inline methods for building python objects of various types.
613 
614 inline
616 {
617  Py_INCREF(Py_None);
618  return Py_None;
619 }
620 
621 inline
623 {
625  static_cast<vtkObjectBase *>(const_cast<void *>(v)));
626 }
627 
628 inline
630  const char *classname)
631 {
632  return PyVTKSpecialObject_CopyNew(classname, v);
633 }
634 
635 inline
637 {
638  /* not implemented */
639  return NULL;
640 }
641 
642 inline
644  const void *v, const char *classname, bool created)
645 {
646  return vtkPythonUtil::SIPGetObjectFromPointer(v, classname, created);
647 }
648 
649 inline
651 {
652  /* not implemented */
653  return NULL;
654 }
655 
656 inline
658 {
659  if (a)
660  {
661  const char *s = vtkPythonUtil::ManglePointer(a, "p_void");
662  return PyString_FromString(s);
663  }
664  Py_INCREF(Py_None);
665  return Py_None;
666 }
667 
668 inline
669 PyObject *vtkPythonArgs::BuildValue(const char *a, size_t l)
670 {
671 #if PY_VERSION_HEX < 0x03000000
672  return PyString_FromStringAndSize(a, static_cast<Py_ssize_t>(l));
673 #else
674 #if PY_VERSION_HEX >= 0x03030000
675  PyObject *o = PyUnicode_FromStringAndSize(a, static_cast<Py_ssize_t>(l));
676 #else
677  PyObject *o = PyUnicode_Decode(a, static_cast<Py_ssize_t>(l), NULL, NULL);
678 #endif
679  if (o == NULL)
680  {
681  PyErr_Clear();
682  o = PyBytes_FromStringAndSize(a, static_cast<Py_ssize_t>(l));
683  }
684  return o;
685 #endif
686 }
687 
688 inline
690 {
691  if (a)
692  {
693  return vtkPythonArgs::BuildValue(a, strlen(a));
694  }
695  Py_INCREF(Py_None);
696  return Py_None;
697 }
698 
699 inline
701 {
702  return vtkPythonArgs::BuildValue(a.data(), a.size());
703 }
704 
705 inline
707 {
708  std::string s;
709  a.utf8_str(s);
710 #ifdef Py_USING_UNICODE
711  return PyUnicode_DecodeUTF8(s.c_str(), static_cast<Py_ssize_t>(s.size()), NULL);
712 #else
713  return PyString_FromStringAndSize(s.c_str(), static_cast<Py_ssize_t>(s.size()));
714 #endif
715 }
716 
717 inline
719 {
720  char b[2];
721  b[0] = a;
722  b[1] = '\0';
723  return PyString_FromString(b);
724 }
725 
726 inline
728 {
729  return PyFloat_FromDouble(a);
730 }
731 
732 inline
734 {
735  return PyBool_FromLong((long)a);
736 }
737 
738 inline
740 {
741  return PyInt_FromLong(a);
742 }
743 
744 inline
746 {
747 #if VTK_SIZEOF_INT < VTK_SIZEOF_LONG
748  return PyInt_FromLong(a);
749 #else
750  if ((long)(a) >= 0)
751  {
752  return PyInt_FromLong((long)(a));
753  }
754  return PyLong_FromUnsignedLong(a);
755 #endif
756 }
757 
758 inline
760 {
761  return PyInt_FromLong(a);
762 }
763 
764 inline
766 {
767  if ((long)(a) >= 0)
768  {
769  return PyInt_FromLong((long)(a));
770  }
771  return PyLong_FromUnsignedLong(a);
772 }
773 
774 inline
776 {
777  return PyLong_FromLongLong(a);
778 }
779 
780 inline
781 PyObject *vtkPythonArgs::BuildValue(unsigned long long a)
782 {
783  return PyLong_FromUnsignedLongLong(a);
784 }
785 
786 inline
787 PyObject *vtkPythonArgs::BuildBytes(const char *a, int n)
788 {
789  return PyBytes_FromStringAndSize(a, n);
790 }
791 
792 #endif
bool GetSIPObject(T *&v, const char *classname)
static void SaveArray(const T *a, T *b, int n)
vtkPythonArgs(PyObject *args, const char *methodname)
Definition: vtkPythonArgs.h:56
bool GetPythonObject(PyObject *&v)
static PyObject * BuildVTKObject(const void *v)
bool GetSpecialObject(T *&v, PyObject *&o, const char *classname)
bool GetSIPEnumValue(T &v, const char *enumname)
static PyObject * BuildValue(const void *v)
int GetArgAsEnum(const char *enumname, bool &valid)
bool NoArgsLeft()
Definition: vtkPythonArgs.h:97
static vtkObjectBase * GetSelfPointer(PyObject *self, PyObject *args)
static bool GetSIPEnumValue(PyObject *o, T &v, const char *enumname)
int GetArgAsSIPEnum(const char *classname, bool &valid)
static bool GetSpecialObject(PyObject *o, T *&v, const char *classname)
static PyObject * BuildSIPObject(const void *v, const char *classname, bool created)
vtkObjectBase * GetArgAsVTKObject(const char *classname, bool &valid)
static bool GetSIPObject(PyObject *o, T *&v, const char *classname)
static bool GetSpecialObject(PyObject *arg, T *&v, PyObject *&o, const char *classname)
void * GetArgAsSpecialObject(const char *classname, PyObject **newobj)
static PyObject * BuildSIPEnumValue(int v, const char *classname)
static bool ErrorOccurred()
bool PureVirtualError()
vtkPythonArgs(PyObject *self, PyObject *args, const char *methodname)
Definition: vtkPythonArgs.h:46
PyObject * GetArgAsPythonObject(bool &valid)
static int GetArgCount(PyObject *args)
static PyObject * BuildBytes(const char *v, int n)
static void * GetSelfSpecialPointer(PyObject *self, PyObject *args)
static bool ArgCountError(int n, const char *name)
const char * utf8_str() const
#define VTKWRAPPINGPYTHONCORE_EXPORT
static PyObject * GetSelfFromFirstArg(PyObject *self, PyObject *args)
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
bool GetVTKObject(T *&v, const char *classname)
static char * ManglePointer(const void *ptr, const char *type)
static int GetArgCount(PyObject *self, PyObject *args)
static bool GetEnumValue(PyObject *o, T &v, const char *enumname)
#define M(row, col)
bool GetVTKObject(PyObject *o, T *&v, const char *classname)
bool GetEnumValue(T &v, const char *enumname)
struct _object PyObject
static bool ArrayHasChanged(const T *a, const T *b, int n)
void * GetArgAsSIPObject(const char *classname, bool &valid)
static PyObject * SIPGetObjectFromPointer(const void *ptr, const char *classname, bool is_new)
bool GetPythonObject(PyObject *o, PyObject *&v)
static PyObject * BuildSpecialObject(const void *v, const char *classname)
bool GetSpecialObject(T *&v, const char *classname)
bool IsPureVirtual()
static PyObject * BuildEnumValue(int v, const char *enumname)
#define PyBytes_FromStringAndSize
static PyObject * BuildNone()
bool CheckArgCount(int nmin, int nmax)
String class that stores Unicode text.
static PyObject * GetObjectFromPointer(vtkObjectBase *ptr)