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();
97 int GetArgSize(
int i);
107 v = (T *)this->GetArgAsVTKObject(classname, b);
122 v =
static_cast<T *
>(this->GetArgAsSpecialObject(classname, &o));
123 return (v != NULL); }
127 v =
static_cast<T *
>(
129 return (v != NULL); }
137 v =
static_cast<T *
>(this->GetArgAsSpecialObject(classname, NULL));
138 return (v != NULL); }
141 v =
static_cast<T *
>(
143 return (v != NULL); }
151 v =
static_cast<T
>(this->GetArgAsEnum(enumname, r));
165 v = (T *)this->GetArgAsSIPObject(classname, r);
179 v =
static_cast<T
>(this->GetArgAsSIPEnum(enumname, r));
196 bool GetValue(
void *&
v);
197 static bool GetValue(
PyObject *o,
void *&
v);
198 bool GetValue(
const void *&
v);
199 static bool GetValue(
PyObject *o,
const void *&
v);
203 bool GetValue(
const char *&
v);
204 static bool GetValue(
PyObject *o,
const char *&
v);
205 bool GetValue(
char *&
v);
206 static bool GetValue(
PyObject *o,
char *&
v);
215 bool GetValue(
char &
v);
216 static bool GetValue(
PyObject *o,
char &
v);
221 bool GetValue(
float &
v);
222 static bool GetValue(
PyObject *o,
float &
v);
223 bool GetValue(
double &
v);
224 static bool GetValue(
PyObject *o,
double &
v);
225 bool GetValue(
bool &
v);
226 static bool GetValue(
PyObject *o,
bool &
v);
227 bool GetValue(
signed char &
v);
228 static bool GetValue(
PyObject *o,
signed char &
v);
229 bool GetValue(
unsigned char &
v);
230 static bool GetValue(
PyObject *o,
unsigned char &
v);
231 bool GetValue(
short &
v);
232 static bool GetValue(
PyObject *o,
short &
v);
233 bool GetValue(
unsigned short &
v);
234 static bool GetValue(
PyObject *o,
unsigned short &
v);
235 bool GetValue(
int &
v);
236 static bool GetValue(
PyObject *o,
int &
v);
237 bool GetValue(
unsigned int &
v);
238 static bool GetValue(
PyObject *o,
unsigned int &
v);
239 bool GetValue(
long &
v);
240 static bool GetValue(
PyObject *o,
long &
v);
241 bool GetValue(
unsigned long &
v);
242 static bool GetValue(
PyObject *o,
unsigned long &
v);
243 #ifdef VTK_TYPE_USE_LONG_LONG
244 bool GetValue(
long long &
v);
245 static bool GetValue(
PyObject *o,
long long &
v);
246 bool GetValue(
unsigned long long &
v);
247 static bool GetValue(
PyObject *o,
unsigned long long &
v);
249 #ifdef VTK_TYPE_USE___INT64
250 bool GetValue(__int64 &
v);
251 static bool GetValue(
PyObject *o, __int64 &
v);
252 bool GetValue(
unsigned __int64 &
v);
253 static bool GetValue(
PyObject *o,
unsigned __int64 &
v);
259 bool GetArray(
float *
v,
int n);
260 bool GetArray(
double *
v,
int n);
261 bool GetArray(
bool *
v,
int n);
262 bool GetArray(
char *
v,
int n);
263 bool GetArray(
signed char *
v,
int n);
264 bool GetArray(
unsigned char *
v,
int n);
265 bool GetArray(
short *
v,
int n);
266 bool GetArray(
unsigned short *
v,
int n);
267 bool GetArray(
int *
v,
int n);
268 bool GetArray(
unsigned int *
v,
int n);
269 bool GetArray(
long *
v,
int n);
270 bool GetArray(
unsigned long *
v,
int n);
271 #ifdef VTK_TYPE_USE_LONG_LONG
272 bool GetArray(
long long *
v,
int n);
273 bool GetArray(
unsigned long long *
v,
int n);
275 #ifdef VTK_TYPE_USE___INT64
276 bool GetArray(__int64 *
v,
int n);
277 bool GetArray(
unsigned __int64 *
v,
int n);
283 bool GetNArray(
float *
v,
int ndims,
const int *dims);
284 bool GetNArray(
double *
v,
int ndims,
const int *dims);
285 bool GetNArray(
bool *
v,
int ndims,
const int *dims);
286 bool GetNArray(
char *
v,
int ndims,
const int *dims);
287 bool GetNArray(
signed char *
v,
int ndims,
const int *dims);
288 bool GetNArray(
unsigned char *
v,
int ndims,
const int *dims);
289 bool GetNArray(
short *
v,
int ndims,
const int *dims);
290 bool GetNArray(
unsigned short *
v,
int ndims,
const int *dims);
291 bool GetNArray(
int *
v,
int ndims,
const int *dims);
292 bool GetNArray(
unsigned int *
v,
int ndims,
const int *dims);
293 bool GetNArray(
long *
v,
int ndims,
const int *dims);
294 bool GetNArray(
unsigned long *
v,
int ndims,
const int *dims);
295 #ifdef VTK_TYPE_USE_LONG_LONG
296 bool GetNArray(
long long *
v,
int ndims,
const int *dims);
297 bool GetNArray(
unsigned long long *
v,
int ndims,
const int *dims);
299 #ifdef VTK_TYPE_USE___INT64
300 bool GetNArray(__int64 *
v,
int ndims,
const int *dims);
301 bool GetNArray(
unsigned __int64 *
v,
int ndims,
const int *dims);
309 bool SetArgValue(
int i,
char v);
310 bool SetArgValue(
int i,
float v);
311 bool SetArgValue(
int i,
double v);
312 bool SetArgValue(
int i,
bool v);
313 bool SetArgValue(
int i,
signed char v);
314 bool SetArgValue(
int i,
unsigned char v);
315 bool SetArgValue(
int i,
short v);
316 bool SetArgValue(
int i,
unsigned short v);
317 bool SetArgValue(
int i,
int v);
318 bool SetArgValue(
int i,
unsigned int v);
319 bool SetArgValue(
int i,
long v);
320 bool SetArgValue(
int i,
unsigned long v);
321 #ifdef VTK_TYPE_USE_LONG_LONG
322 bool SetArgValue(
int i,
long long v);
323 bool SetArgValue(
int i,
unsigned long long v);
325 #ifdef VTK_TYPE_USE___INT64
326 bool SetArgValue(
int i, __int64
v);
327 bool SetArgValue(
int i,
unsigned __int64
v);
333 bool SetArray(
int i,
const float *
v,
int n);
334 bool SetArray(
int i,
const double *
v,
int n);
335 bool SetArray(
int i,
const bool *
v,
int n);
336 bool SetArray(
int i,
const char *
v,
int n);
337 bool SetArray(
int i,
const signed char *
v,
int n);
338 bool SetArray(
int i,
const unsigned char *
v,
int n);
339 bool SetArray(
int i,
const short *
v,
int n);
340 bool SetArray(
int i,
const unsigned short *
v,
int n);
341 bool SetArray(
int i,
const int *
v,
int n);
342 bool SetArray(
int i,
const unsigned int *
v,
int n);
343 bool SetArray(
int i,
const long *
v,
int n);
344 bool SetArray(
int i,
const unsigned long *
v,
int n);
345 #ifdef VTK_TYPE_USE_LONG_LONG
346 bool SetArray(
int i,
const long long *
v,
int n);
347 bool SetArray(
int i,
const unsigned long long *
v,
int n);
349 #ifdef VTK_TYPE_USE___INT64
350 bool SetArray(
int i,
const __int64 *
v,
int n);
351 bool SetArray(
int i,
const unsigned __int64 *
v,
int n);
357 bool SetNArray(
int i,
const float *
v,
int n,
const int *d);
358 bool SetNArray(
int i,
const double *
v,
int n,
const int *d);
359 bool SetNArray(
int i,
const bool *
v,
int n,
const int *d);
360 bool SetNArray(
int i,
const char *
v,
int n,
const int *d);
361 bool SetNArray(
int i,
const signed char *
v,
int n,
const int *d);
362 bool SetNArray(
int i,
const unsigned char *
v,
int n,
const int *d);
363 bool SetNArray(
int i,
const short *
v,
int n,
const int *d);
364 bool SetNArray(
int i,
const unsigned short *
v,
int n,
const int *d);
365 bool SetNArray(
int i,
const int *
v,
int n,
const int *d);
366 bool SetNArray(
int i,
const unsigned int *
v,
int n,
const int *d);
367 bool SetNArray(
int i,
const long *
v,
int n,
const int *d);
368 bool SetNArray(
int i,
const unsigned long *
v,
int n,
const int *d);
369 #ifdef VTK_TYPE_USE_LONG_LONG
370 bool SetNArray(
int i,
const long long *
v,
int n,
const int *d);
371 bool SetNArray(
int i,
const unsigned long long *
v,
int n,
const int *d);
373 #ifdef VTK_TYPE_USE___INT64
374 bool SetNArray(
int i,
const __int64 *
v,
int n,
const int *d);
375 bool SetNArray(
int i,
const unsigned __int64 *
v,
int n,
const int *d);
384 static PyObject *BuildVTKObject(
const void *
v);
387 static PyObject *BuildSpecialObject(
const void *
v,
const char *classname);
390 static PyObject *BuildEnumValue(
int v,
const char *enumname);
396 const void *
v,
const char *classname,
bool created);
400 static PyObject *BuildSIPEnumValue(
int v,
const char *classname);
403 static PyObject *BuildValue(
const void *
v);
407 static PyObject *BuildValue(
const char *
v);
420 static PyObject *BuildValue(
unsigned int v);
422 static PyObject *BuildValue(
unsigned long v);
423 #ifdef VTK_TYPE_USE_LONG_LONG
424 static PyObject *BuildValue(
long long v);
425 static PyObject *BuildValue(
unsigned long long v);
427 #ifdef VTK_TYPE_USE___INT64
429 static PyObject *BuildValue(
unsigned __int64
v);
434 static PyObject *BuildBytes(
const char *
v,
int n);
438 static PyObject *BuildTuple(
const float *
v,
int n);
439 static PyObject *BuildTuple(
const double *
v,
int n);
440 static PyObject *BuildTuple(
const bool *
v,
int n);
441 static PyObject *BuildTuple(
const signed char *
v,
int n);
442 static PyObject *BuildTuple(
const unsigned char *
v,
int n);
443 static PyObject *BuildTuple(
const short *
v,
int n);
444 static PyObject *BuildTuple(
const unsigned short *
v,
int n);
445 static PyObject *BuildTuple(
const int *
v,
int n);
446 static PyObject *BuildTuple(
const unsigned int *
v,
int n);
447 static PyObject *BuildTuple(
const long *
v,
int n);
448 static PyObject *BuildTuple(
const unsigned long *
v,
int n);
449 #ifdef VTK_TYPE_USE_LONG_LONG
450 static PyObject *BuildTuple(
const long long *
v,
int n);
451 static PyObject *BuildTuple(
const unsigned long long *
v,
int n);
453 #ifdef VTK_TYPE_USE___INT64
454 static PyObject *BuildTuple(
const __int64 *
v,
int n);
455 static PyObject *BuildTuple(
const unsigned __int64 *
v,
int n);
464 do { b[i] = a[i]; }
while (++i < n); }
472 do {
if (a[i] != b[i])
break; }
while (++i < n);
479 return static_cast<int>(PyTuple_GET_SIZE(args)); }
485 return (static_cast<int>(PyTuple_GET_SIZE(args)) -
486 PyVTKClass_Check(
self)); }
490 static bool ArgCountError(
int n,
const char *
name);
500 vtkObjectBase *GetArgAsVTKObject(
const char *classname,
bool &valid);
502 PyObject *o,
const char *classname,
bool &valid);
507 void *GetArgAsSpecialObject(
const char *classname,
PyObject **newobj);
508 static void *GetArgAsSpecialObject(
514 int GetArgAsEnum(
const char *classname,
bool &valid);
515 static int GetArgAsEnum(
516 PyObject *o,
const char *classname,
bool &valid);
521 void *GetArgAsSIPObject(
const char *classname,
bool &valid);
522 static void *GetArgAsSIPObject(
523 PyObject *o,
const char *classname,
bool &valid);
528 int GetArgAsSIPEnum(
const char *classname,
bool &valid);
529 static int GetArgAsSIPEnum(
530 PyObject *o,
const char *classname,
bool &valid);
534 bool PureVirtualError();
537 bool ArgCountError(
int m,
int n);
540 bool RefineArgTypeError(
int i);
545 const char *MethodName;
559 if (PyVTKClass_Check(
self))
563 return ((PyVTKObject *)
self)->vtk_ptr;
570 return ((PyVTKSpecialObject *)
self)->vtk_ptr;
580 int nargs = this->N - this->M;
581 if (nargs >= nmin && nargs <= nmax)
593 int nargs = this->N - this->M;
622 return (PyErr_Occurred() != NULL);
639 static_cast<vtkObjectBase *>(const_cast<void *>(v)));
644 const char *classname)
646 return PyVTKSpecialObject_CopyNew(classname, v);
658 const void *
v,
const char *classname,
bool created)
676 return PyString_FromString(s);
687 return PyString_FromString(a);
696 return PyString_FromStringAndSize(a.c_str(),
static_cast<Py_ssize_t>(a.size()));
704 #ifdef Py_USING_UNICODE
705 return PyUnicode_DecodeUTF8(s.c_str(),
static_cast<Py_ssize_t>(s.size()), NULL);
707 return PyString_FromStringAndSize(s.c_str(),
static_cast<Py_ssize_t>(s.size()));
717 return PyString_FromString(b);
723 return PyFloat_FromDouble(a);
729 #if PY_VERSION_HEX >= 0x02030000
730 return PyBool_FromLong((
long)a);
732 return PyInt_FromLong((
long)a);
739 return PyInt_FromLong(a);
745 #if VTK_SIZEOF_INT < VTK_SIZEOF_LONG
746 return PyInt_FromLong(a);
750 return PyInt_FromLong((
long)(a));
752 return PyLong_FromUnsignedLong(a);
759 return PyInt_FromLong(a);
767 return PyInt_FromLong((
long)(a));
769 return PyLong_FromUnsignedLong(a);
772 #if defined(VTK_TYPE_USE_LONG_LONG)
776 #if defined(PY_LONG_LONG)
777 return PyLong_FromLongLong(a);
779 return PyLong_FromLong((
long)(a));
786 #if defined(PY_LONG_LONG)
787 return PyLong_FromUnsignedLongLong(a);
789 return PyLong_FromUnsignedLong((
unsigned long)(a));
794 #if defined(VTK_TYPE_USE___INT64)
798 #if defined(PY_LONG_LONG)
799 return PyLong_FromLongLong(a);
801 return PyLong_FromLong((
long)(a));
808 #if defined(PY_LONG_LONG)
809 return PyLong_FromUnsignedLongLong(a);
811 return PyLong_FromUnsignedLong((
unsigned long)(a));
819 return PyString_FromStringAndSize(a, n);
int GetArgAsEnum(const char *classname, bool &valid)
bool GetSIPObject(T *&v, const char *classname)
static void SaveArray(const T *a, T *b, int n)
GLboolean GLboolean GLboolean b
vtkPythonArgs(PyObject *args, const char *methodname)
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)
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)
static bool ErrorOccurred()
GLdouble GLdouble GLdouble r
vtkPythonArgs(PyObject *self, PyObject *args, const char *methodname)
static int GetArgCount(PyObject *args)
static PyObject * BuildBytes(const char *v, int n)
GLuint const GLchar * name
static bool ArgCountError(int n, const char *name)
const char * utf8_str() const
#define VTKWRAPPINGPYTHONCORE_EXPORT
abstract base class for most VTK objects
bool GetVTKObject(T *&v, const char *classname)
static char * ManglePointer(const void *ptr, const char *type)
static int GetArgCount(PyObject *self, PyObject *args)
GLboolean GLboolean GLboolean GLboolean a
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)
static PyObject * BuildEnumValue(int v, const char *enumname)
GLsizei const GLchar ** string
static PyObject * BuildNone()
bool CheckArgCount(int nmin, int nmax)
String class that stores Unicode text.
static PyObject * GetObjectFromPointer(vtkObjectBase *ptr)