Go to the documentation of this file.
27 #ifndef vtkPythonArgs_h
28 #define vtkPythonArgs_h
32 #include "PyVTKClass.h"
33 #include "PyVTKTemplate.h"
47 Args(args), MethodName(methodname) {
48 this->N = PyTuple_GET_SIZE(args);
49 this->
M = PyVTKClass_Check(
self);
57 Args(args), MethodName(methodname) {
58 this->N = PyTuple_GET_SIZE(args);
74 static void *GetSelfPointer(
PyObject *
self);
77 bool CheckArgCount(
int nmin,
int nmax);
80 bool CheckArgCount(
int n);
89 static bool ErrorOccurred();
103 v = this->GetArgAsPythonObject(
b);
119 v = (T *)this->GetArgAsVTKObject(classname,
b);
134 v =
static_cast<T *
>(this->GetArgAsSpecialObject(classname, &o));
135 return (
v != NULL); }
139 v =
static_cast<T *
>(
141 return (
v != NULL); }
149 v =
static_cast<T *
>(this->GetArgAsSpecialObject(classname, NULL));
150 return (
v != NULL); }
153 v =
static_cast<T *
>(
155 return (
v != NULL); }
163 v =
static_cast<T
>(this->GetArgAsEnum(enumtype,
r));
177 v = (T *)this->GetArgAsSIPObject(classname,
r);
191 v =
static_cast<T
>(this->GetArgAsSIPEnum(enumname,
r));
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);
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);
283 #ifdef VTK_TYPE_USE_LONG_LONG
284 bool GetArray(
long long *
v,
int n);
285 bool GetArray(
unsigned long long *
v,
int n);
287 #ifdef VTK_TYPE_USE___INT64
288 bool GetArray(__int64 *
v,
int n);
289 bool GetArray(
unsigned __int64 *
v,
int n);
300 bool GetNArray(
unsigned char *
v,
int ndims,
const int *dims);
302 bool GetNArray(
unsigned short *
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);
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);
333 #ifdef VTK_TYPE_USE_LONG_LONG
334 bool SetArgValue(
int i,
long long v);
335 bool SetArgValue(
int i,
unsigned long long v);
337 #ifdef VTK_TYPE_USE___INT64
338 bool SetArgValue(
int i, __int64
v);
339 bool SetArgValue(
int i,
unsigned __int64
v);
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);
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);
374 bool SetNArray(
int i,
const unsigned char *
v,
int n,
const int *d);
376 bool SetNArray(
int i,
const unsigned short *
v,
int n,
const int *d);
378 bool SetNArray(
int i,
const unsigned int *
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);
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);
396 static PyObject *BuildVTKObject(
const void *
v);
399 static PyObject *BuildSpecialObject(
const void *
v,
const char *classname);
402 static PyObject *BuildEnumValue(
int v,
const char *enumname);
408 const void *
v,
const char *classname,
bool created);
412 static PyObject *BuildSIPEnumValue(
int v,
const char *classname);
415 static PyObject *BuildValue(
const void *
v);
419 static PyObject *BuildValue(
const char *
v);
432 static PyObject *BuildValue(
unsigned int 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);
439 #ifdef VTK_TYPE_USE___INT64
441 static PyObject *BuildValue(
unsigned __int64
v);
446 static PyObject *BuildBytes(
const char *
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);
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);
476 do {
b[i] =
a[i]; }
while (++i <
n); }
484 do {
if (
a[i] !=
b[i])
break; }
while (++i <
n);
491 return static_cast<int>(PyTuple_GET_SIZE(args)); }
497 return (
static_cast<int>(PyTuple_GET_SIZE(args)) -
498 PyVTKClass_Check(
self)); }
521 PyObject *o,
const char *classname,
bool &valid);
535 PyObject *o, PyTypeObject *enumtype,
bool &valid);
542 PyObject *o,
const char *classname,
bool &valid);
549 PyObject *o,
const char *classname,
bool &valid);
564 const char *MethodName;
578 if (PyVTKClass_Check(
self))
582 return ((PyVTKObject *)
self)->vtk_ptr;
589 return ((PyVTKSpecialObject *)
self)->vtk_ptr;
599 int nargs = this->N - this->M;
600 if (nargs >= nmin && nargs <= nmax)
612 int nargs = this->N - this->M;
641 return (PyErr_Occurred() != NULL);
663 const char *classname)
665 return PyVTKSpecialObject_CopyNew(classname,
v);
677 const void *
v,
const char *classname,
bool created)
695 return PyString_FromString(
s);
706 return PyString_FromString(
a);
715 return PyString_FromStringAndSize(
a.c_str(),
static_cast<Py_ssize_t>(
a.size()));
723 #ifdef Py_USING_UNICODE
724 return PyUnicode_DecodeUTF8(
s.c_str(),
static_cast<Py_ssize_t>(
s.size()), NULL);
726 return PyString_FromStringAndSize(
s.c_str(),
static_cast<Py_ssize_t>(
s.size()));
736 return PyString_FromString(
b);
742 return PyFloat_FromDouble(
a);
748 #if PY_VERSION_HEX >= 0x02030000
749 return PyBool_FromLong((
long)
a);
751 return PyInt_FromLong((
long)
a);
758 return PyInt_FromLong(
a);
764 #if VTK_SIZEOF_INT < VTK_SIZEOF_LONG
765 return PyInt_FromLong(
a);
769 return PyInt_FromLong((
long)(
a));
771 return PyLong_FromUnsignedLong(
a);
778 return PyInt_FromLong(
a);
786 return PyInt_FromLong((
long)(
a));
788 return PyLong_FromUnsignedLong(
a);
791 #if defined(VTK_TYPE_USE_LONG_LONG)
795 #if defined(PY_LONG_LONG)
796 return PyLong_FromLongLong(
a);
798 return PyLong_FromLong((
long)(
a));
805 #if defined(PY_LONG_LONG)
806 return PyLong_FromUnsignedLongLong(
a);
808 return PyLong_FromUnsignedLong((
unsigned long)(
a));
813 #if defined(VTK_TYPE_USE___INT64)
817 #if defined(PY_LONG_LONG)
818 return PyLong_FromLongLong(
a);
820 return PyLong_FromLong((
long)(
a));
827 #if defined(PY_LONG_LONG)
828 return PyLong_FromUnsignedLongLong(
a);
830 return PyLong_FromUnsignedLong((
unsigned long)(
a));
838 return PyString_FromStringAndSize(
a,
n);
bool SetArray(int i, const long *v, int n)
static PyObject * BuildSIPEnumValue(int v, const char *classname)
static vtkObjectBase * GetArgAsVTKObject(PyObject *o, const char *classname, bool &valid)
static PyObject * BuildTuple(const unsigned long *v, int n)
bool SetNArray(int i, const unsigned int *v, int n, const int *d)
int GetArgAsEnum(PyTypeObject *enumtype, bool &valid)
bool SetArgValue(int i, const std::string &v)
static PyObject * BuildTuple(const double *v, int n)
static bool GetSIPEnumValue(PyObject *o, T &v, const char *enumname)
PyObject * GetArgAsPythonObject(bool &valid)
bool GetVTKObject(PyObject *o, T *&v, const char *classname)
static PyObject * BuildNone()
bool GetNArray(unsigned long *v, int ndims, const int *dims)
GLboolean GLboolean GLboolean b
static bool GetValue(PyObject *o, double &v)
bool SetArgValue(int i, unsigned long v)
bool SetArgValue(int i, double v)
bool GetVTKObject(T *&v, const char *classname)
vtkObjectBase * GetArgAsVTKObject(const char *classname, bool &valid)
bool SetArray(int i, const unsigned long *v, int n)
static bool GetValue(PyObject *o, vtkUnicodeString &v)
vtkPythonArgs(PyObject *args, const char *methodname)
bool GetValue(std::string &v)
static bool GetSIPObject(PyObject *o, T *&v, const char *classname)
bool GetSIPObject(T *&v, const char *classname)
bool GetNArray(float *v, int ndims, const int *dims)
static PyObject * GetArgAsPythonObject(PyObject *o, bool &valid)
static bool GetSpecialObject(PyObject *arg, T *&v, PyObject *&o, const char *classname)
#define VTKWRAPPINGPYTHONCORE_EXPORT
bool SetArgValue(int i, int v)
bool GetSpecialObject(T *&v, const char *classname)
static void * GetArgAsSIPObject(PyObject *o, const char *classname, bool &valid)
static PyObject * BuildTuple(const unsigned short *v, int n)
bool SetNArray(int i, const short *v, int n, const int *d)
bool GetArray(unsigned short *v, int n)
bool SetArray(int i, const short *v, int n)
static PyObject * SIPGetObjectFromPointer(const void *ptr, const char *classname, bool is_new)
bool GetArray(unsigned int *v, int n)
static bool GetValue(PyObject *o, unsigned char &v)
bool SetArray(int i, const int *v, int n)
static int GetArgAsEnum(PyObject *o, PyTypeObject *enumtype, bool &valid)
bool SetArgValue(int i, const vtkUnicodeString &v)
static bool GetValue(PyObject *o, int &v)
bool GetNArray(unsigned int *v, int ndims, const int *dims)
bool GetArray(char *v, int n)
static int GetArgCount(PyObject *args)
bool SetNArray(int i, const int *v, int n, const int *d)
bool GetValue(vtkUnicodeString &v)
static bool GetValue(PyObject *o, unsigned int &v)
void * GetArgAsSIPObject(const char *classname, bool &valid)
static bool GetValue(PyObject *o, std::string &v)
bool GetNArray(long *v, int ndims, const int *dims)
bool GetValue(const char *&v)
static int GetArgCount(PyObject *self, PyObject *args)
static void SaveArray(const T *a, T *b, int n)
bool GetArray(long *v, int n)
static bool GetValue(PyObject *o, bool &v)
static PyObject * BuildVTKObject(const void *v)
bool GetNArray(double *v, int ndims, const int *dims)
static int GetArgAsSIPEnum(PyObject *o, const char *classname, bool &valid)
bool SetNArray(int i, const long *v, int n, const int *d)
GLuint const GLchar * name
static bool ErrorOccurred()
bool RefineArgTypeError(int i)
bool ArgCountError(int m, int n)
vtkPythonArgs(PyObject *self, PyObject *args, const char *methodname)
bool SetArray(int i, const unsigned char *v, int n)
static bool GetValue(PyObject *o, unsigned short &v)
static PyObject * BuildTuple(const float *v, int n)
bool SetArray(int i, const float *v, int n)
bool SetArgValue(int i, float v)
bool SetNArray(int i, const bool *v, int n, const int *d)
abstract base class for most VTK objects
bool GetArray(signed char *v, int n)
static bool GetValue(PyObject *o, float &v)
bool SetNArray(int i, const float *v, int n, const int *d)
static bool GetValue(PyObject *o, const char *&v)
static char * ManglePointer(const void *ptr, const char *type)
bool SetArray(int i, const unsigned short *v, int n)
bool SetArgValue(int i, unsigned char v)
static bool GetValue(PyObject *o, char *&v)
static bool GetValue(PyObject *o, short &v)
static bool GetValue(PyObject *o, unsigned long &v)
bool SetArgValue(int i, signed char v)
String class that stores Unicode text.
bool SetArgValue(int i, bool v)
bool GetPythonObject(PyObject *&v)
static bool GetSpecialObject(PyObject *o, T *&v, const char *classname)
bool SetArray(int i, const double *v, int n)
bool SetNArray(int i, const signed char *v, int n, const int *d)
static bool GetValue(PyObject *o, const void *&v)
bool GetValue(signed char &v)
bool GetArray(short *v, int n)
static bool GetFunction(PyObject *arg, PyObject *&o)
bool GetArray(float *v, int n)
bool GetNArray(char *v, int ndims, const int *dims)
static void * GetArgAsSpecialObject(PyObject *o, const char *classname, PyObject **newobj)
static bool ArgCountError(int n, const char *name)
GLboolean GLboolean GLboolean GLboolean a
static vtkObjectBase * GetSelfPointer(PyObject *self, PyObject *args)
bool SetNArray(int i, const unsigned char *v, int n, const int *d)
bool SetArray(int i, const bool *v, int n)
static bool GetValue(PyObject *o, char &v)
bool GetNArray(int *v, int ndims, const int *dims)
bool SetArgValue(int i, unsigned int v)
bool GetArray(unsigned char *v, int n)
bool SetArgValue(int i, short v)
bool GetValue(unsigned long &v)
bool SetArgValue(int i, unsigned short v)
static bool ArrayHasChanged(const T *a, const T *b, int n)
static bool GetValue(PyObject *o, signed char &v)
static bool GetValue(PyObject *o, long &v)
static PyObject * BuildTuple(const bool *v, int n)
static PyObject * BuildSpecialObject(const void *v, const char *classname)
GLdouble GLdouble GLdouble r
bool SetArray(int i, const char *v, int n)
bool SetNArray(int i, const unsigned long *v, int n, const int *d)
static PyObject * BuildEnumValue(int v, const char *enumname)
void * GetArgAsSpecialObject(const char *classname, PyObject **newobj)
static PyObject * BuildTuple(const long *v, int n)
static bool GetEnumValue(PyObject *o, T &v, PyTypeObject *enumtype)
bool GetValue(unsigned int &v)
bool SetArray(int i, const unsigned int *v, int n)
bool GetNArray(short *v, int ndims, const int *dims)
bool SetNArray(int i, const char *v, int n, const int *d)
static PyObject * BuildTuple(const unsigned char *v, int n)
bool GetNArray(bool *v, int ndims, const int *dims)
bool CheckArgCount(int nmin, int nmax)
bool GetValue(const void *&v)
static PyObject * BuildTuple(const unsigned int *v, int n)
static vtkObjectBase * GetSelfFromFirstArg(PyObject *self, PyObject *args)
bool GetNArray(unsigned char *v, int ndims, const int *dims)
bool GetEnumValue(T &v, PyTypeObject *enumtype)
bool GetFunction(PyObject *&o)
bool SetNArray(int i, const unsigned short *v, int n, const int *d)
bool SetArray(int i, const signed char *v, int n)
bool GetArray(bool *v, int n)
int GetArgAsSIPEnum(const char *classname, bool &valid)
bool SetNArray(int i, const double *v, int n, const int *d)
bool GetValue(unsigned char &v)
bool GetArray(double *v, int n)
static PyObject * BuildSIPObject(const void *v, const char *classname, bool created)
static PyObject * BuildBytes(const char *v, int n)
bool GetNArray(signed char *v, int ndims, const int *dims)
bool GetArray(unsigned long *v, int n)
static bool GetValue(PyObject *o, void *&v)
bool GetNArray(unsigned short *v, int ndims, const int *dims)
bool SetArgValue(int i, char v)
bool GetValue(unsigned short &v)
GLsizei const GLchar ** string
bool GetPythonObject(PyObject *o, PyObject *&v)
bool GetSIPEnumValue(T &v, const char *enumname)
static PyObject * GetObjectFromPointer(vtkObjectBase *ptr)
static PyObject * BuildTuple(const short *v, int n)
static PyObject * BuildTuple(const int *v, int n)
static PyObject * BuildTuple(const signed char *v, int n)
bool GetSpecialObject(T *&v, PyObject *&o, const char *classname)
bool GetArray(int *v, int n)
bool SetArgValue(int i, long v)
static PyObject * BuildValue(const void *v)