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 "PyVTKClass.h"
33 #include "PyVTKTemplate.h"
34 
35 #include "vtkConfigure.h"
36 #include "vtkUnicodeString.h"
37 
38 #include <string>
39 
40 class VTKWRAPPINGPYTHONCORE_EXPORT vtkPythonArgs
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 = PyVTKClass_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 
74  static void *GetSelfPointer(PyObject *self);
75 
77  bool CheckArgCount(int nmin, int nmax);
78 
80  bool CheckArgCount(int n);
81 
83  bool IsBound() { return (this->M == 0); }
84 
86  bool IsPureVirtual();
87 
89  static bool ErrorOccurred();
90 
92  bool NoArgsLeft() { return (this->I >= this->N); }
93 
97  int GetArgSize(int i);
98 
100 
102  bool b;
103  v = this->GetArgAsPythonObject(b);
104  return b; }
106  bool b;
108  return b; }
110 
112 
116  template<class T>
117  bool GetVTKObject(T *&v, const char *classname) {
118  bool b;
119  v = (T *)this->GetArgAsVTKObject(classname, b);
120  return b; }
121  template<class T>
122  bool GetVTKObject(PyObject *o, T *&v, const char *classname) {
123  bool b;
124  v = (T *)vtkPythonArgs::GetArgAsVTKObject(o, classname, b);
125  return b; }
127 
129 
132  template<class T>
133  bool GetSpecialObject(T *&v, PyObject *&o, const char *classname) {
134  v = static_cast<T *>(this->GetArgAsSpecialObject(classname, &o));
135  return (v != NULL); }
136  template<class T>
137  static bool GetSpecialObject(
138  PyObject *arg, T *&v, PyObject *&o, const char *classname) {
139  v = static_cast<T *>(
140  vtkPythonArgs::GetArgAsSpecialObject(arg, classname, &o));
141  return (v != NULL); }
143 
145 
147  template<class T>
148  bool GetSpecialObject(T *&v, const char *classname) {
149  v = static_cast<T *>(this->GetArgAsSpecialObject(classname, NULL));
150  return (v != NULL); }
151  template<class T>
152  static bool GetSpecialObject(PyObject *o, T *&v, const char *classname) {
153  v = static_cast<T *>(
154  vtkPythonArgs::GetArgAsSpecialObject(o, classname, NULL));
155  return (v != NULL); }
157 
159 
160  template<class T>
161  bool GetEnumValue(T &v, PyTypeObject *enumtype) {
162  bool r;
163  v = static_cast<T>(this->GetArgAsEnum(enumtype, r));
164  return r; }
165  template<class T>
166  static bool GetEnumValue(PyObject *o, T &v, PyTypeObject *enumtype) {
167  bool r;
168  v = static_cast<T>(vtkPythonArgs::GetArgAsEnum(o, enumtype, r));
169  return r; }
171 
173 
174  template<class T>
175  bool GetSIPObject(T *&v, const char *classname) {
176  bool r;
177  v = (T *)this->GetArgAsSIPObject(classname, r);
178  return r; }
179  template<class T>
180  static bool GetSIPObject(PyObject *o, T *&v, const char *classname) {
181  bool r;
182  v = (T *)vtkPythonArgs::GetArgAsSIPObject(o, classname, r);
183  return r; }
185 
187 
188  template<class T>
189  bool GetSIPEnumValue(T &v, const char *enumname) {
190  bool r;
191  v = static_cast<T>(this->GetArgAsSIPEnum(enumname, r));
192  return r; }
193  template<class T>
194  static bool GetSIPEnumValue(PyObject *o, T &v, const char *enumname) {
195  bool r;
196  v = static_cast<T>(vtkPythonArgs::GetArgAsSIPEnum(o, enumname, r));
197  return r; }
199 
201 
203  bool GetFunction(PyObject *&o);
204  static bool GetFunction(PyObject *arg, PyObject *&o);
206 
207  // Get the next arg as a void pointer (to a buffer object).
208  bool GetValue(void *&v);
209  static bool GetValue(PyObject *o, void *&v);
210  bool GetValue(const void *&v);
211  static bool GetValue(PyObject *o, const void *&v);
212 
214 
215  bool GetValue(const char *&v);
216  static bool GetValue(PyObject *o, const char *&v);
217  bool GetValue(char *&v);
218  static bool GetValue(PyObject *o, char *&v);
219  bool GetValue(std::string &v);
220  static bool GetValue(PyObject *o, std::string &v);
221  bool GetValue(vtkUnicodeString &v);
222  static bool GetValue(PyObject *o, vtkUnicodeString &v);
224 
226 
227  bool GetValue(char &v);
228  static bool GetValue(PyObject *o, char &v);
230 
232 
233  bool GetValue(float &v);
234  static bool GetValue(PyObject *o, float &v);
235  bool GetValue(double &v);
236  static bool GetValue(PyObject *o, double &v);
237  bool GetValue(bool &v);
238  static bool GetValue(PyObject *o, bool &v);
239  bool GetValue(signed char &v);
240  static bool GetValue(PyObject *o, signed char &v);
241  bool GetValue(unsigned char &v);
242  static bool GetValue(PyObject *o, unsigned char &v);
243  bool GetValue(short &v);
244  static bool GetValue(PyObject *o, short &v);
245  bool GetValue(unsigned short &v);
246  static bool GetValue(PyObject *o, unsigned short &v);
247  bool GetValue(int &v);
248  static bool GetValue(PyObject *o, int &v);
249  bool GetValue(unsigned int &v);
250  static bool GetValue(PyObject *o, unsigned int &v);
251  bool GetValue(long &v);
252  static bool GetValue(PyObject *o, long &v);
253  bool GetValue(unsigned long &v);
254  static bool GetValue(PyObject *o, unsigned long &v);
255 #ifdef VTK_TYPE_USE_LONG_LONG
256  bool GetValue(long long &v);
257  static bool GetValue(PyObject *o, long long &v);
258  bool GetValue(unsigned long long &v);
259  static bool GetValue(PyObject *o, unsigned long long &v);
260 #endif
261 #ifdef VTK_TYPE_USE___INT64
262  bool GetValue(__int64 &v);
263  static bool GetValue(PyObject *o, __int64 &v);
264  bool GetValue(unsigned __int64 &v);
265  static bool GetValue(PyObject *o, unsigned __int64 &v);
266 #endif
267 
268 
270 
271  bool GetArray(float *v, int n);
272  bool GetArray(double *v, int n);
273  bool GetArray(bool *v, int n);
274  bool GetArray(char *v, int n);
275  bool GetArray(signed char *v, int n);
276  bool GetArray(unsigned char *v, int n);
277  bool GetArray(short *v, int n);
278  bool GetArray(unsigned short *v, int n);
279  bool GetArray(int *v, int n);
280  bool GetArray(unsigned int *v, int n);
281  bool GetArray(long *v, int n);
282  bool GetArray(unsigned long *v, int n);
283 #ifdef VTK_TYPE_USE_LONG_LONG
284  bool GetArray(long long *v, int n);
285  bool GetArray(unsigned long long *v, int n);
286 #endif
287 #ifdef VTK_TYPE_USE___INT64
288  bool GetArray(__int64 *v, int n);
289  bool GetArray(unsigned __int64 *v, int n);
290 #endif
291 
292 
294 
295  bool GetNArray(float *v, int ndims, const int *dims);
296  bool GetNArray(double *v, int ndims, const int *dims);
297  bool GetNArray(bool *v, int ndims, const int *dims);
298  bool GetNArray(char *v, int ndims, const int *dims);
299  bool GetNArray(signed char *v, int ndims, const int *dims);
300  bool GetNArray(unsigned char *v, int ndims, const int *dims);
301  bool GetNArray(short *v, int ndims, const int *dims);
302  bool GetNArray(unsigned short *v, int ndims, const int *dims);
303  bool GetNArray(int *v, int ndims, const int *dims);
304  bool GetNArray(unsigned int *v, int ndims, const int *dims);
305  bool GetNArray(long *v, int ndims, const int *dims);
306  bool GetNArray(unsigned long *v, int ndims, const int *dims);
307 #ifdef VTK_TYPE_USE_LONG_LONG
308  bool GetNArray(long long *v, int ndims, const int *dims);
309  bool GetNArray(unsigned long long *v, int ndims, const int *dims);
310 #endif
311 #ifdef VTK_TYPE_USE___INT64
312  bool GetNArray(__int64 *v, int ndims, const int *dims);
313  bool GetNArray(unsigned __int64 *v, int ndims, const int *dims);
314 #endif
315 
316 
318 
319  bool SetArgValue(int i, const std::string &v);
320  bool SetArgValue(int i, const vtkUnicodeString &v);
321  bool SetArgValue(int i, char v);
322  bool SetArgValue(int i, float v);
323  bool SetArgValue(int i, double v);
324  bool SetArgValue(int i, bool v);
325  bool SetArgValue(int i, signed char v);
326  bool SetArgValue(int i, unsigned char v);
327  bool SetArgValue(int i, short v);
328  bool SetArgValue(int i, unsigned short v);
329  bool SetArgValue(int i, int v);
330  bool SetArgValue(int i, unsigned int v);
331  bool SetArgValue(int i, long v);
332  bool SetArgValue(int i, unsigned long v);
333 #ifdef VTK_TYPE_USE_LONG_LONG
334  bool SetArgValue(int i, long long v);
335  bool SetArgValue(int i, unsigned long long v);
336 #endif
337 #ifdef VTK_TYPE_USE___INT64
338  bool SetArgValue(int i, __int64 v);
339  bool SetArgValue(int i, unsigned __int64 v);
340 #endif
341 
342 
344 
345  bool SetArray(int i, const float *v, int n);
346  bool SetArray(int i, const double *v, int n);
347  bool SetArray(int i, const bool *v, int n);
348  bool SetArray(int i, const char *v, int n);
349  bool SetArray(int i, const signed char *v, int n);
350  bool SetArray(int i, const unsigned char *v, int n);
351  bool SetArray(int i, const short *v, int n);
352  bool SetArray(int i, const unsigned short *v, int n);
353  bool SetArray(int i, const int *v, int n);
354  bool SetArray(int i, const unsigned int *v, int n);
355  bool SetArray(int i, const long *v, int n);
356  bool SetArray(int i, const unsigned long *v, int n);
357 #ifdef VTK_TYPE_USE_LONG_LONG
358  bool SetArray(int i, const long long *v, int n);
359  bool SetArray(int i, const unsigned long long *v, int n);
360 #endif
361 #ifdef VTK_TYPE_USE___INT64
362  bool SetArray(int i, const __int64 *v, int n);
363  bool SetArray(int i, const unsigned __int64 *v, int n);
364 #endif
365 
366 
368 
369  bool SetNArray(int i, const float *v, int n, const int *d);
370  bool SetNArray(int i, const double *v, int n, const int *d);
371  bool SetNArray(int i, const bool *v, int n, const int *d);
372  bool SetNArray(int i, const char *v, int n, const int *d);
373  bool SetNArray(int i, const signed char *v, int n, const int *d);
374  bool SetNArray(int i, const unsigned char *v, int n, const int *d);
375  bool SetNArray(int i, const short *v, int n, const int *d);
376  bool SetNArray(int i, const unsigned short *v, int n, const int *d);
377  bool SetNArray(int i, const int *v, int n, const int *d);
378  bool SetNArray(int i, const unsigned int *v, int n, const int *d);
379  bool SetNArray(int i, const long *v, int n, const int *d);
380  bool SetNArray(int i, const unsigned long *v, int n, const int *d);
381 #ifdef VTK_TYPE_USE_LONG_LONG
382  bool SetNArray(int i, const long long *v, int n, const int *d);
383  bool SetNArray(int i, const unsigned long long *v, int n, const int *d);
384 #endif
385 #ifdef VTK_TYPE_USE___INT64
386  bool SetNArray(int i, const __int64 *v, int n, const int *d);
387  bool SetNArray(int i, const unsigned __int64 *v, int n, const int *d);
388 #endif
389 
390 
392  static PyObject *BuildNone();
393 
396  static PyObject *BuildVTKObject(const void *v);
397 
399  static PyObject *BuildSpecialObject(const void *v, const char *classname);
400 
402  static PyObject *BuildEnumValue(int v, const char *enumname);
403 
405 
407  static PyObject *BuildSIPObject(
408  const void *v, const char *classname, bool created);
410 
412  static PyObject *BuildSIPEnumValue(int v, const char *classname);
413 
415  static PyObject *BuildValue(const void *v);
416 
418 
419  static PyObject *BuildValue(const char *v);
420  static PyObject *BuildValue(const std::string &v);
421  static PyObject *BuildValue(const vtkUnicodeString &v);
423 
425  static PyObject *BuildValue(char v);
426 
428 
429  static PyObject *BuildValue(double v);
430  static PyObject *BuildValue(bool v);
431  static PyObject *BuildValue(int v);
432  static PyObject *BuildValue(unsigned int v);
433  static PyObject *BuildValue(long v);
434  static PyObject *BuildValue(unsigned long v);
435 #ifdef VTK_TYPE_USE_LONG_LONG
436  static PyObject *BuildValue(long long v);
437  static PyObject *BuildValue(unsigned long long v);
438 #endif
439 #ifdef VTK_TYPE_USE___INT64
440  static PyObject *BuildValue(__int64 v);
441  static PyObject *BuildValue(unsigned __int64 v);
442 #endif
443 
444 
446  static PyObject *BuildBytes(const char *v, int n);
447 
449 
450  static PyObject *BuildTuple(const float *v, int n);
451  static PyObject *BuildTuple(const double *v, int n);
452  static PyObject *BuildTuple(const bool *v, int n);
453  static PyObject *BuildTuple(const signed char *v, int n);
454  static PyObject *BuildTuple(const unsigned char *v, int n);
455  static PyObject *BuildTuple(const short *v, int n);
456  static PyObject *BuildTuple(const unsigned short *v, int n);
457  static PyObject *BuildTuple(const int *v, int n);
458  static PyObject *BuildTuple(const unsigned int *v, int n);
459  static PyObject *BuildTuple(const long *v, int n);
460  static PyObject *BuildTuple(const unsigned long *v, int n);
461 #ifdef VTK_TYPE_USE_LONG_LONG
462  static PyObject *BuildTuple(const long long *v, int n);
463  static PyObject *BuildTuple(const unsigned long long *v, int n);
464 #endif
465 #ifdef VTK_TYPE_USE___INT64
466  static PyObject *BuildTuple(const __int64 *v, int n);
467  static PyObject *BuildTuple(const unsigned __int64 *v, int n);
468 #endif
469 
470 
472 
473  template<class T>
474  static void SaveArray(const T *a, T *b, int n) {
475  int i = 0;
476  do { b[i] = a[i]; } while (++i < n); }
478 
480 
481  template<class T>
482  static bool ArrayHasChanged(const T *a, const T *b, int n) {
483  int i = 0;
484  do { if (a[i] != b[i]) break; } while (++i < n);
485  return (i < n); }
487 
489 
490  static int GetArgCount(PyObject *args) {
491  return static_cast<int>(PyTuple_GET_SIZE(args)); }
493 
495 
496  static int GetArgCount(PyObject *self, PyObject *args) {
497  return (static_cast<int>(PyTuple_GET_SIZE(args)) -
498  PyVTKClass_Check(self)); }
500 
502  static bool ArgCountError(int n, const char *name);
503 
504 
505 protected:
506 
508  static vtkObjectBase *GetSelfFromFirstArg(PyObject *self, PyObject *args);
509 
511 
512  PyObject *GetArgAsPythonObject(bool &valid);
513  static PyObject *GetArgAsPythonObject(
514  PyObject *o, bool &valid);
516 
518 
519  vtkObjectBase *GetArgAsVTKObject(const char *classname, bool &valid);
520  static vtkObjectBase *GetArgAsVTKObject(
521  PyObject *o, const char *classname, bool &valid);
523 
525 
526  void *GetArgAsSpecialObject(const char *classname, PyObject **newobj);
527  static void *GetArgAsSpecialObject(
528  PyObject *o, const char *classname, PyObject **newobj);
530 
532 
533  int GetArgAsEnum(PyTypeObject *enumtype, bool &valid);
534  static int GetArgAsEnum(
535  PyObject *o, PyTypeObject *enumtype, bool &valid);
537 
539 
540  void *GetArgAsSIPObject(const char *classname, bool &valid);
541  static void *GetArgAsSIPObject(
542  PyObject *o, const char *classname, bool &valid);
544 
546 
547  int GetArgAsSIPEnum(const char *classname, bool &valid);
548  static int GetArgAsSIPEnum(
549  PyObject *o, const char *classname, bool &valid);
551 
553  bool PureVirtualError();
554 
556  bool ArgCountError(int m, int n);
557 
559  bool RefineArgTypeError(int i);
560 
561 private:
562 
563  PyObject *Args;
564  const char *MethodName;
565 
566  int N; // size of args tuple
567  int M; // 1 if Self is a PyVTKClass and first arg is the PyVTKObject
568  int I; // the arg counter, starts at M
569 };
570 
571 //--------------------------------------------------------------------
572 // Inline methods for getting "self" as its original type
573 
574 // Get "self" from a PyVTKObject, which contains a vtkObjectBase object.
575 inline
577 {
578  if (PyVTKClass_Check(self))
579  {
580  return vtkPythonArgs::GetSelfFromFirstArg(self, args);
581  }
582  return ((PyVTKObject *)self)->vtk_ptr;
583 }
584 
585 // Get "self" from a PyVTKSpecialObject.
586 inline
588 {
589  return ((PyVTKSpecialObject *)self)->vtk_ptr;
590 }
591 
592 //--------------------------------------------------------------------
593 // Inline methods for checking the arg count
594 
595 // Verify the arg count for a method with optional arguments.
596 inline
597 bool vtkPythonArgs::CheckArgCount(int nmin, int nmax)
598 {
599  int nargs = this->N - this->M;
600  if (nargs >= nmin && nargs <= nmax)
601  {
602  return true;
603  }
604  this->ArgCountError(nmin, nmax);
605  return false;
606 }
607 
608 // Verify the arg count for a method with optional arguments.
609 inline
611 {
612  int nargs = this->N - this->M;
613  if (nargs == n)
614  {
615  return true;
616  }
617  this->ArgCountError(n, n);
618  return false;
619 }
620 
621 //--------------------------------------------------------------------
622 // Inline method for guarding against pure virtual method calls
623 
624 inline
626 {
627  if (IsBound())
628  {
629  return false;
630  }
631  this->PureVirtualError();
632  return true;
633 }
634 
635 //--------------------------------------------------------------------
636 // Inline method for checking if an error has occurred.
637 
638 inline
640 {
641  return (PyErr_Occurred() != NULL);
642 }
643 
644 //--------------------------------------------------------------------
645 // Inline methods for building python objects of various types.
646 
647 inline
649 {
650  Py_INCREF(Py_None);
651  return Py_None;
652 }
653 
654 inline
656 {
658  static_cast<vtkObjectBase *>(const_cast<void *>(v)));
659 }
660 
661 inline
663  const char *classname)
664 {
665  return PyVTKSpecialObject_CopyNew(classname, v);
666 }
667 
668 inline
670 {
671  /* not implemented */
672  return NULL;
673 }
674 
675 inline
677  const void *v, const char *classname, bool created)
678 {
679  return vtkPythonUtil::SIPGetObjectFromPointer(v, classname, created);
680 }
681 
682 inline
684 {
685  /* not implemented */
686  return NULL;
687 }
688 
689 inline
691 {
692  if (a)
693  {
694  const char *s = vtkPythonUtil::ManglePointer(a, "p_void");
695  return PyString_FromString(s);
696  }
697  Py_INCREF(Py_None);
698  return Py_None;
699 }
700 
701 inline
703 {
704  if (a)
705  {
706  return PyString_FromString(a);
707  }
708  Py_INCREF(Py_None);
709  return Py_None;
710 }
711 
712 inline
714 {
715  return PyString_FromStringAndSize(a.c_str(), static_cast<Py_ssize_t>(a.size()));
716 }
717 
718 inline
720 {
721  std::string s;
722  a.utf8_str(s);
723 #ifdef Py_USING_UNICODE
724  return PyUnicode_DecodeUTF8(s.c_str(), static_cast<Py_ssize_t>(s.size()), NULL);
725 #else
726  return PyString_FromStringAndSize(s.c_str(), static_cast<Py_ssize_t>(s.size()));
727 #endif
728 }
729 
730 inline
732 {
733  char b[2];
734  b[0] = a;
735  b[1] = '\0';
736  return PyString_FromString(b);
737 }
738 
739 inline
741 {
742  return PyFloat_FromDouble(a);
743 }
744 
745 inline
747 {
748 #if PY_VERSION_HEX >= 0x02030000
749  return PyBool_FromLong((long)a);
750 #else
751  return PyInt_FromLong((long)a);
752 #endif
753 }
754 
755 inline
757 {
758  return PyInt_FromLong(a);
759 }
760 
761 inline
763 {
764 #if VTK_SIZEOF_INT < VTK_SIZEOF_LONG
765  return PyInt_FromLong(a);
766 #else
767  if ((long)(a) >= 0)
768  {
769  return PyInt_FromLong((long)(a));
770  }
771  return PyLong_FromUnsignedLong(a);
772 #endif
773 }
774 
775 inline
777 {
778  return PyInt_FromLong(a);
779 }
780 
781 inline
783 {
784  if ((long)(a) >= 0)
785  {
786  return PyInt_FromLong((long)(a));
787  }
788  return PyLong_FromUnsignedLong(a);
789 }
790 
791 #if defined(VTK_TYPE_USE_LONG_LONG)
792 inline
794 {
795 #if defined(PY_LONG_LONG)
796  return PyLong_FromLongLong(a);
797 #else
798  return PyLong_FromLong((long)(a));
799 #endif
800 }
801 
802 inline
803 PyObject *vtkPythonArgs::BuildValue(unsigned long long a)
804 {
805 #if defined(PY_LONG_LONG)
806  return PyLong_FromUnsignedLongLong(a);
807 #else
808  return PyLong_FromUnsignedLong((unsigned long)(a));
809 #endif
810 }
811 #endif
812 
813 #if defined(VTK_TYPE_USE___INT64)
814 inline
816 {
817 #if defined(PY_LONG_LONG)
818  return PyLong_FromLongLong(a);
819 #else
820  return PyLong_FromLong((long)(a));
821 #endif
822 }
823 
824 inline
825 PyObject *vtkPythonArgs::BuildValue(unsigned __int64 a)
826 {
827 #if defined(PY_LONG_LONG)
828  return PyLong_FromUnsignedLongLong(a);
829 #else
830  return PyLong_FromUnsignedLong((unsigned long)(a));
831 #endif
832 }
833 #endif
834 
835 inline
836 PyObject *vtkPythonArgs::BuildBytes(const char *a, int n)
837 {
838  return PyString_FromStringAndSize(a, n);
839 }
840 
841 #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)
bool NoArgsLeft()
Definition: vtkPythonArgs.h:92
static vtkObjectBase * GetSelfPointer(PyObject *self, PyObject *args)
static bool GetSIPEnumValue(PyObject *o, T &v, const char *enumname)
static vtkObjectBase * GetSelfFromFirstArg(PyObject *self, PyObject *args)
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)
int Py_ssize_t
static bool ErrorOccurred()
bool PureVirtualError()
vtkPythonArgs(PyObject *self, PyObject *args, const char *methodname)
Definition: vtkPythonArgs.h:46
int GetArgAsEnum(PyTypeObject *enumtype, bool &valid)
PyObject * GetArgAsPythonObject(bool &valid)
static int GetArgCount(PyObject *args)
static PyObject * BuildBytes(const char *v, int n)
static bool GetEnumValue(PyObject *o, T &v, PyTypeObject *enumtype)
static bool ArgCountError(int n, const char *name)
const char * utf8_str() const
bool GetEnumValue(T &v, PyTypeObject *enumtype)
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)
#define M(row, col)
bool GetVTKObject(PyObject *o, T *&v, const char *classname)
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)
static PyObject * BuildNone()
bool CheckArgCount(int nmin, int nmax)
String class that stores Unicode text.
static PyObject * GetObjectFromPointer(vtkObjectBase *ptr)