VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
95 
99  template<class T>
100  bool GetVTKObject(T *&v, const char *classname) {
101  bool b;
102  v = (T *)this->GetArgAsVTKObject(classname, b);
103  return b; }
104  template<class T>
105  bool GetVTKObject(PyObject *o, T *&v, const char *classname) {
106  bool b;
107  v = (T *)vtkPythonArgs::GetArgAsVTKObject(o, classname, b);
108  return b; }
110 
112 
115  template<class T>
116  bool GetSpecialObject(T *&v, PyObject *&o, const char *classname) {
117  v = static_cast<T *>(this->GetArgAsSpecialObject(classname, &o));
118  return (v != NULL); }
119  template<class T>
120  static bool GetSpecialObject(
121  PyObject *arg, T *&v, PyObject *&o, const char *classname) {
122  v = static_cast<T *>(
123  vtkPythonArgs::GetArgAsSpecialObject(arg, classname, &o));
124  return (v != NULL); }
126 
128 
130  template<class T>
131  bool GetSpecialObject(T *&v, const char *classname) {
132  v = static_cast<T *>(this->GetArgAsSpecialObject(classname, NULL));
133  return (v != NULL); }
134  template<class T>
135  static bool GetSpecialObject(PyObject *o, T *&v, const char *classname) {
136  v = static_cast<T *>(
137  vtkPythonArgs::GetArgAsSpecialObject(o, classname, NULL));
138  return (v != NULL); }
140 
142 
143  template<class T>
144  bool GetEnumValue(T &v, const char *enumname) {
145  bool r;
146  v = static_cast<T>(this->GetArgAsEnum(enumname, r));
147  return r; }
148  template<class T>
149  static bool GetEnumValue(PyObject *o, T &v, const char *enumname) {
150  bool r;
151  v = static_cast<T>(vtkPythonArgs::GetArgAsEnum(o, enumname, r));
152  return r; }
154 
156 
157  template<class T>
158  bool GetSIPObject(T *&v, const char *classname) {
159  bool r;
160  v = (T *)this->GetArgAsSIPObject(classname, r);
161  return r; }
162  template<class T>
163  static bool GetSIPObject(PyObject *o, T *&v, const char *classname) {
164  bool r;
165  v = (T *)vtkPythonArgs::GetArgAsSIPObject(o, classname, r);
166  return r; }
168 
170 
171  template<class T>
172  bool GetSIPEnumValue(T &v, const char *enumname) {
173  bool r;
174  v = static_cast<T>(this->GetArgAsSIPEnum(enumname, r));
175  return r; }
176  template<class T>
177  static bool GetSIPEnumValue(PyObject *o, T &v, const char *enumname) {
178  bool r;
179  v = static_cast<T>(vtkPythonArgs::GetArgAsSIPEnum(o, enumname, r));
180  return r; }
182 
184 
186  bool GetFunction(PyObject *&o);
187  static bool GetFunction(PyObject *arg, PyObject *&o);
189 
190  // Get the next arg as a void pointer (to a buffer object).
191  bool GetValue(void *&v);
192  static bool GetValue(PyObject *o, void *&v);
193  bool GetValue(const void *&v);
194  static bool GetValue(PyObject *o, const void *&v);
195 
197 
198  bool GetValue(const char *&v);
199  static bool GetValue(PyObject *o, const char *&v);
200  bool GetValue(char *&v);
201  static bool GetValue(PyObject *o, char *&v);
202  bool GetValue(std::string &v);
203  static bool GetValue(PyObject *o, std::string &v);
204  bool GetValue(vtkUnicodeString &v);
205  static bool GetValue(PyObject *o, vtkUnicodeString &v);
207 
209 
210  bool GetValue(char &v);
211  static bool GetValue(PyObject *o, char &v);
213 
215 
216  bool GetValue(float &v);
217  static bool GetValue(PyObject *o, float &v);
218  bool GetValue(double &v);
219  static bool GetValue(PyObject *o, double &v);
220  bool GetValue(bool &v);
221  static bool GetValue(PyObject *o, bool &v);
222  bool GetValue(signed char &v);
223  static bool GetValue(PyObject *o, signed char &v);
224  bool GetValue(unsigned char &v);
225  static bool GetValue(PyObject *o, unsigned char &v);
226  bool GetValue(short &v);
227  static bool GetValue(PyObject *o, short &v);
228  bool GetValue(unsigned short &v);
229  static bool GetValue(PyObject *o, unsigned short &v);
230  bool GetValue(int &v);
231  static bool GetValue(PyObject *o, int &v);
232  bool GetValue(unsigned int &v);
233  static bool GetValue(PyObject *o, unsigned int &v);
234  bool GetValue(long &v);
235  static bool GetValue(PyObject *o, long &v);
236  bool GetValue(unsigned long &v);
237  static bool GetValue(PyObject *o, unsigned long &v);
238 #ifdef VTK_TYPE_USE_LONG_LONG
239  bool GetValue(long long &v);
240  static bool GetValue(PyObject *o, long long &v);
241  bool GetValue(unsigned long long &v);
242  static bool GetValue(PyObject *o, unsigned long long &v);
243 #endif
244 #ifdef VTK_TYPE_USE___INT64
245  bool GetValue(__int64 &v);
246  static bool GetValue(PyObject *o, __int64 &v);
247  bool GetValue(unsigned __int64 &v);
248  static bool GetValue(PyObject *o, unsigned __int64 &v);
249 #endif
250 
251 
253 
254  bool GetArray(float *v, int n);
255  bool GetArray(double *v, int n);
256  bool GetArray(bool *v, int n);
257  bool GetArray(char *v, int n);
258  bool GetArray(signed char *v, int n);
259  bool GetArray(unsigned char *v, int n);
260  bool GetArray(short *v, int n);
261  bool GetArray(unsigned short *v, int n);
262  bool GetArray(int *v, int n);
263  bool GetArray(unsigned int *v, int n);
264  bool GetArray(long *v, int n);
265  bool GetArray(unsigned long *v, int n);
266 #ifdef VTK_TYPE_USE_LONG_LONG
267  bool GetArray(long long *v, int n);
268  bool GetArray(unsigned long long *v, int n);
269 #endif
270 #ifdef VTK_TYPE_USE___INT64
271  bool GetArray(__int64 *v, int n);
272  bool GetArray(unsigned __int64 *v, int n);
273 #endif
274 
275 
277 
278  bool GetNArray(float *v, int ndims, const int *dims);
279  bool GetNArray(double *v, int ndims, const int *dims);
280  bool GetNArray(bool *v, int ndims, const int *dims);
281  bool GetNArray(char *v, int ndims, const int *dims);
282  bool GetNArray(signed char *v, int ndims, const int *dims);
283  bool GetNArray(unsigned char *v, int ndims, const int *dims);
284  bool GetNArray(short *v, int ndims, const int *dims);
285  bool GetNArray(unsigned short *v, int ndims, const int *dims);
286  bool GetNArray(int *v, int ndims, const int *dims);
287  bool GetNArray(unsigned int *v, int ndims, const int *dims);
288  bool GetNArray(long *v, int ndims, const int *dims);
289  bool GetNArray(unsigned long *v, int ndims, const int *dims);
290 #ifdef VTK_TYPE_USE_LONG_LONG
291  bool GetNArray(long long *v, int ndims, const int *dims);
292  bool GetNArray(unsigned long long *v, int ndims, const int *dims);
293 #endif
294 #ifdef VTK_TYPE_USE___INT64
295  bool GetNArray(__int64 *v, int ndims, const int *dims);
296  bool GetNArray(unsigned __int64 *v, int ndims, const int *dims);
297 #endif
298 
299 
301 
302  bool SetArgValue(int i, const std::string &v);
303  bool SetArgValue(int i, const vtkUnicodeString &v);
304  bool SetArgValue(int i, char v);
305  bool SetArgValue(int i, float v);
306  bool SetArgValue(int i, double v);
307  bool SetArgValue(int i, bool v);
308  bool SetArgValue(int i, signed char v);
309  bool SetArgValue(int i, unsigned char v);
310  bool SetArgValue(int i, short v);
311  bool SetArgValue(int i, unsigned short v);
312  bool SetArgValue(int i, int v);
313  bool SetArgValue(int i, unsigned int v);
314  bool SetArgValue(int i, long v);
315  bool SetArgValue(int i, unsigned long v);
316 #ifdef VTK_TYPE_USE_LONG_LONG
317  bool SetArgValue(int i, long long v);
318  bool SetArgValue(int i, unsigned long long v);
319 #endif
320 #ifdef VTK_TYPE_USE___INT64
321  bool SetArgValue(int i, __int64 v);
322  bool SetArgValue(int i, unsigned __int64 v);
323 #endif
324 
325 
327 
328  bool SetArray(int i, const float *v, int n);
329  bool SetArray(int i, const double *v, int n);
330  bool SetArray(int i, const bool *v, int n);
331  bool SetArray(int i, const char *v, int n);
332  bool SetArray(int i, const signed char *v, int n);
333  bool SetArray(int i, const unsigned char *v, int n);
334  bool SetArray(int i, const short *v, int n);
335  bool SetArray(int i, const unsigned short *v, int n);
336  bool SetArray(int i, const int *v, int n);
337  bool SetArray(int i, const unsigned int *v, int n);
338  bool SetArray(int i, const long *v, int n);
339  bool SetArray(int i, const unsigned long *v, int n);
340 #ifdef VTK_TYPE_USE_LONG_LONG
341  bool SetArray(int i, const long long *v, int n);
342  bool SetArray(int i, const unsigned long long *v, int n);
343 #endif
344 #ifdef VTK_TYPE_USE___INT64
345  bool SetArray(int i, const __int64 *v, int n);
346  bool SetArray(int i, const unsigned __int64 *v, int n);
347 #endif
348 
349 
351 
352  bool SetNArray(int i, const float *v, int n, const int *d);
353  bool SetNArray(int i, const double *v, int n, const int *d);
354  bool SetNArray(int i, const bool *v, int n, const int *d);
355  bool SetNArray(int i, const char *v, int n, const int *d);
356  bool SetNArray(int i, const signed char *v, int n, const int *d);
357  bool SetNArray(int i, const unsigned char *v, int n, const int *d);
358  bool SetNArray(int i, const short *v, int n, const int *d);
359  bool SetNArray(int i, const unsigned short *v, int n, const int *d);
360  bool SetNArray(int i, const int *v, int n, const int *d);
361  bool SetNArray(int i, const unsigned int *v, int n, const int *d);
362  bool SetNArray(int i, const long *v, int n, const int *d);
363  bool SetNArray(int i, const unsigned long *v, int n, const int *d);
364 #ifdef VTK_TYPE_USE_LONG_LONG
365  bool SetNArray(int i, const long long *v, int n, const int *d);
366  bool SetNArray(int i, const unsigned long long *v, int n, const int *d);
367 #endif
368 #ifdef VTK_TYPE_USE___INT64
369  bool SetNArray(int i, const __int64 *v, int n, const int *d);
370  bool SetNArray(int i, const unsigned __int64 *v, int n, const int *d);
371 #endif
372 
373 
375  static PyObject *BuildNone();
376 
379  static PyObject *BuildVTKObject(const void *v);
380 
382  static PyObject *BuildSpecialObject(const void *v, const char *classname);
383 
385  static PyObject *BuildEnumValue(int v, const char *enumname);
386 
388 
390  static PyObject *BuildSIPObject(
391  const void *v, const char *classname, bool created);
393 
395  static PyObject *BuildSIPEnumValue(int v, const char *classname);
396 
398  static PyObject *BuildValue(const void *v);
399 
401 
402  static PyObject *BuildValue(const char *v);
403  static PyObject *BuildValue(const std::string &v);
404  static PyObject *BuildValue(const vtkUnicodeString &v);
406 
408  static PyObject *BuildValue(char v);
409 
411 
412  static PyObject *BuildValue(double v);
413  static PyObject *BuildValue(bool v);
414  static PyObject *BuildValue(int v);
415  static PyObject *BuildValue(unsigned int v);
416  static PyObject *BuildValue(long v);
417  static PyObject *BuildValue(unsigned long v);
418 #ifdef VTK_TYPE_USE_LONG_LONG
419  static PyObject *BuildValue(long long v);
420  static PyObject *BuildValue(unsigned long long v);
421 #endif
422 #ifdef VTK_TYPE_USE___INT64
423  static PyObject *BuildValue(__int64 v);
424  static PyObject *BuildValue(unsigned __int64 v);
425 #endif
426 
427 
429  static PyObject *BuildBytes(const char *v, int n);
430 
432 
433  static PyObject *BuildTuple(const float *v, int n);
434  static PyObject *BuildTuple(const double *v, int n);
435  static PyObject *BuildTuple(const bool *v, int n);
436  static PyObject *BuildTuple(const signed char *v, int n);
437  static PyObject *BuildTuple(const unsigned char *v, int n);
438  static PyObject *BuildTuple(const short *v, int n);
439  static PyObject *BuildTuple(const unsigned short *v, int n);
440  static PyObject *BuildTuple(const int *v, int n);
441  static PyObject *BuildTuple(const unsigned int *v, int n);
442  static PyObject *BuildTuple(const long *v, int n);
443  static PyObject *BuildTuple(const unsigned long *v, int n);
444 #ifdef VTK_TYPE_USE_LONG_LONG
445  static PyObject *BuildTuple(const long long *v, int n);
446  static PyObject *BuildTuple(const unsigned long long *v, int n);
447 #endif
448 #ifdef VTK_TYPE_USE___INT64
449  static PyObject *BuildTuple(const __int64 *v, int n);
450  static PyObject *BuildTuple(const unsigned __int64 *v, int n);
451 #endif
452 
453 
455 
456  template<class T>
457  static void SaveArray(const T *a, T *b, int n) {
458  int i = 0;
459  do { b[i] = a[i]; } while (++i < n); }
461 
463 
464  template<class T>
465  static bool ArrayHasChanged(const T *a, const T *b, int n) {
466  int i = 0;
467  do { if (a[i] != b[i]) break; } while (++i < n);
468  return (i < n); }
470 
472 
473  static int GetArgCount(PyObject *args) {
474  return static_cast<int>(PyTuple_GET_SIZE(args)); }
476 
478 
479  static int GetArgCount(PyObject *self, PyObject *args) {
480  return (static_cast<int>(PyTuple_GET_SIZE(args)) -
481  PyVTKClass_Check(self)); }
483 
485  static bool ArgCountError(int n, const char *name);
486 
487 
488 protected:
489 
491  static vtkObjectBase *GetSelfFromFirstArg(PyObject *self, PyObject *args);
492 
494 
495  vtkObjectBase *GetArgAsVTKObject(const char *classname, bool &valid);
496  static vtkObjectBase *GetArgAsVTKObject(
497  PyObject *o, const char *classname, bool &valid);
499 
501 
502  void *GetArgAsSpecialObject(const char *classname, PyObject **newobj);
503  static void *GetArgAsSpecialObject(
504  PyObject *o, const char *classname, PyObject **newobj);
506 
508 
509  int GetArgAsEnum(const char *classname, bool &valid);
510  static int GetArgAsEnum(
511  PyObject *o, const char *classname, bool &valid);
513 
515 
516  void *GetArgAsSIPObject(const char *classname, bool &valid);
517  static void *GetArgAsSIPObject(
518  PyObject *o, const char *classname, bool &valid);
520 
522 
523  int GetArgAsSIPEnum(const char *classname, bool &valid);
524  static int GetArgAsSIPEnum(
525  PyObject *o, const char *classname, bool &valid);
527 
529  bool PureVirtualError();
530 
532  bool ArgCountError(int m, int n);
533 
535  bool RefineArgTypeError(int i);
536 
537 private:
538 
539  PyObject *Args;
540  const char *MethodName;
541 
542  int N; // size of args tuple
543  int M; // 1 if Self is a PyVTKClass and first arg is the PyVTKObject
544  int I; // the arg counter, starts at M
545 };
546 
547 //--------------------------------------------------------------------
548 // Inline methods for getting "self" as its original type
549 
550 // Get "self" from a PyVTKObject, which contains a vtkObjectBase object.
551 inline
552 vtkObjectBase *vtkPythonArgs::GetSelfPointer(PyObject *self, PyObject *args)
553 {
554  if (PyVTKClass_Check(self))
555  {
556  return vtkPythonArgs::GetSelfFromFirstArg(self, args);
557  }
558  return ((PyVTKObject *)self)->vtk_ptr;
559 }
560 
561 // Get "self" from a PyVTKSpecialObject.
562 inline
563 void *vtkPythonArgs::GetSelfPointer(PyObject *self)
564 {
565  return ((PyVTKSpecialObject *)self)->vtk_ptr;
566 }
567 
568 //--------------------------------------------------------------------
569 // Inline methods for checking the arg count
570 
571 // Verify the arg count for a method with optional arguments.
572 inline
573 bool vtkPythonArgs::CheckArgCount(int nmin, int nmax)
574 {
575  int nargs = this->N - this->M;
576  if (nargs >= nmin && nargs <= nmax)
577  {
578  return true;
579  }
580  this->ArgCountError(nmin, nmax);
581  return false;
582 }
583 
584 // Verify the arg count for a method with optional arguments.
585 inline
587 {
588  int nargs = this->N - this->M;
589  if (nargs == n)
590  {
591  return true;
592  }
593  this->ArgCountError(n, n);
594  return false;
595 }
596 
597 //--------------------------------------------------------------------
598 // Inline method for guarding against pure virtual method calls
599 
600 inline
602 {
603  if (IsBound())
604  {
605  return false;
606  }
607  this->PureVirtualError();
608  return true;
609 }
610 
611 //--------------------------------------------------------------------
612 // Inline method for checking if an error has occurred.
613 
614 inline
616 {
617  return (PyErr_Occurred() != NULL);
618 }
619 
620 //--------------------------------------------------------------------
621 // Inline methods for building python objects of various types.
622 
623 inline
625 {
626  Py_INCREF(Py_None);
627  return Py_None;
628 }
629 
630 inline
631 PyObject *vtkPythonArgs::BuildVTKObject(const void *v)
632 {
634  static_cast<vtkObjectBase *>(const_cast<void *>(v)));
635 }
636 
637 inline
638 PyObject *vtkPythonArgs::BuildSpecialObject(const void *v,
639  const char *classname)
640 {
641  return PyVTKSpecialObject_CopyNew(classname, v);
642 }
643 
644 inline
645 PyObject *vtkPythonArgs::BuildEnumValue(int, const char *)
646 {
647  /* not implemented */
648  return NULL;
649 }
650 
651 inline
653  const void *v, const char *classname, bool created)
654 {
655  return vtkPythonUtil::SIPGetObjectFromPointer(v, classname, created);
656 }
657 
658 inline
659 PyObject *vtkPythonArgs::BuildSIPEnumValue(int, const char *)
660 {
661  /* not implemented */
662  return NULL;
663 }
664 
665 inline
666 PyObject *vtkPythonArgs::BuildValue(const void *a)
667 {
668  if (a)
669  {
670  const char *s = vtkPythonUtil::ManglePointer(a, "void_p");
671  return PyString_FromString(s);
672  }
673  Py_INCREF(Py_None);
674  return Py_None;
675 }
676 
677 inline
678 PyObject *vtkPythonArgs::BuildValue(const char *a)
679 {
680  if (a)
681  {
682  return PyString_FromString(a);
683  }
684  Py_INCREF(Py_None);
685  return Py_None;
686 }
687 
688 inline
689 PyObject *vtkPythonArgs::BuildValue(const std::string &a)
690 {
691  return PyString_FromStringAndSize(a.c_str(), static_cast<Py_ssize_t>(a.size()));
692 }
693 
694 inline
695 PyObject *vtkPythonArgs::BuildValue(const vtkUnicodeString &a)
696 {
697  std::string s;
698  a.utf8_str(s);
699 #ifdef Py_USING_UNICODE
700  return PyUnicode_DecodeUTF8(s.c_str(), static_cast<Py_ssize_t>(s.size()), NULL);
701 #else
702  return PyString_FromStringAndSize(s.c_str(), static_cast<Py_ssize_t>(s.size()));
703 #endif
704 }
705 
706 inline
707 PyObject *vtkPythonArgs::BuildValue(char a)
708 {
709  char b[2];
710  b[0] = a;
711  b[1] = '\0';
712  return PyString_FromString(b);
713 }
714 
715 inline
716 PyObject *vtkPythonArgs::BuildValue(double a)
717 {
718  return PyFloat_FromDouble(a);
719 }
720 
721 inline
722 PyObject *vtkPythonArgs::BuildValue(bool a)
723 {
724 #if PY_VERSION_HEX >= 0x02030000
725  return PyBool_FromLong((long)a);
726 #else
727  return PyInt_FromLong((long)a);
728 #endif
729 }
730 
731 inline
733 {
734  return PyInt_FromLong(a);
735 }
736 
737 inline
738 PyObject *vtkPythonArgs::BuildValue(unsigned int a)
739 {
740 #if VTK_SIZEOF_INT < VTK_SIZEOF_LONG
741  return PyInt_FromLong(a);
742 #else
743  if ((long)(a) >= 0)
744  {
745  return PyInt_FromLong((long)(a));
746  }
747  return PyLong_FromUnsignedLong(a);
748 #endif
749 }
750 
751 inline
752 PyObject *vtkPythonArgs::BuildValue(long a)
753 {
754  return PyInt_FromLong(a);
755 }
756 
757 inline
758 PyObject *vtkPythonArgs::BuildValue(unsigned long a)
759 {
760  if ((long)(a) >= 0)
761  {
762  return PyInt_FromLong((long)(a));
763  }
764  return PyLong_FromUnsignedLong(a);
765 }
766 
767 #if defined(VTK_TYPE_USE_LONG_LONG)
768 inline
769 PyObject *vtkPythonArgs::BuildValue(long long a)
770 {
771 #if defined(PY_LONG_LONG)
772  return PyLong_FromLongLong(a);
773 #else
774  return PyLong_FromLong((long)(a));
775 #endif
776 }
777 
778 inline
779 PyObject *vtkPythonArgs::BuildValue(unsigned long long a)
780 {
781 #if defined(PY_LONG_LONG)
782  return PyLong_FromUnsignedLongLong(a);
783 #else
784  return PyLong_FromUnsignedLong((unsigned long)(a));
785 #endif
786 }
787 #endif
788 
789 #if defined(VTK_TYPE_USE___INT64)
790 inline
791 PyObject *vtkPythonArgs::BuildValue(__int64 a)
792 {
793 #if defined(PY_LONG_LONG)
794  return PyLong_FromLongLong(a);
795 #else
796  return PyLong_FromLong((long)(a));
797 #endif
798 }
799 
800 inline
801 PyObject *vtkPythonArgs::BuildValue(unsigned __int64 a)
802 {
803 #if defined(PY_LONG_LONG)
804  return PyLong_FromUnsignedLongLong(a);
805 #else
806  return PyLong_FromUnsignedLong((unsigned long)(a));
807 #endif
808 }
809 #endif
810 
811 inline
812 PyObject *vtkPythonArgs::BuildBytes(const char *a, int n)
813 {
814  return PyString_FromStringAndSize(a, n);
815 }
816 
817 #endif
int GetArgAsEnum(const char *classname, bool &valid)
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
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
static int GetArgCount(PyObject *args)
static PyObject * BuildBytes(const char *v, int n)
static bool ArgCountError(int n, const char *name)
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)
bool GetVTKObject(PyObject *o, T *&v, const char *classname)
bool GetEnumValue(T &v, const char *enumname)
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)
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)
static PyObject * GetObjectFromPointer(vtkObjectBase *ptr)