// python wrapper for vtkInstantiator // #define VTK_WRAPPING_CXX #define VTK_STREAMS_FWD_ONLY #include "vtkPythonArgs.h" #include "vtkPythonOverload.h" #include "vtkConfigure.h" #include #include #include "vtkVariant.h" #include "vtkIndent.h" #include "vtkInstantiator.h" extern "C" { VTK_ABI_EXPORT void PyVTKAddFile_vtkInstantiator(PyObject *); } extern "C" { VTK_ABI_EXPORT PyObject *PyvtkInstantiator_ClassNew(); } #ifndef DECLARED_PyvtkObject_ClassNew extern "C" { PyObject *PyvtkObject_ClassNew(); } #define DECLARED_PyvtkObject_ClassNew #endif static const char *PyvtkInstantiator_Doc = "vtkInstantiator - create an instance of any VTK class from its name.\n\n" "Superclass: vtkObject\n\n" "vtkInstantiator provides an interface to create an instance of any\n" "VTK class from its name. Instances are created through registered\n" "pointers to functions returning the objects. New classes can also be\n" "registered with the creator. VTK libraries automatically register\n" "their classes with the creator when they are loaded. Instances are\n" "created using the static New() method, so the normal vtkObjectFactory\n" "mechanism is still invoked.\n\n" "When using this class from language wrappers (Tcl, Python, or Java),\n" "the vtkInstantiator should be able to create any class from any kit\n" "that has been loaded.\n\n" "In C++ code, one should include the header for each kit from which\n" "one wishes to create instances through vtkInstantiator. This is\n" "necessary to ensure proper linking when building static libraries. Be\n" "careful, though, because including each kit's header means every\n" "class from that kit will be linked into your executable whether or\n" "not the class is used. The headers are:\n\n\n" " vtkCommon - vtkCommonInstantiator.h\n" " vtkFiltering - vtkFilteringInstantiator.h\n" " vtkIO - vtkIOInstantiator.h\n" " vtkImaging - vtkImagingInstantiator.h\n" " vtkGraphics - vtkGraphicsInstantiator.h\n" " vtkRendering - vtkRenderingInstantiator.h\n" " vtkVolumeRendering - vtkVolumeRenderingInstantiator.h\n" " vtkHybrid - vtkHybridInstantiator.h\n" " vtkParallel - vtkParallelInstantiator.h\n\n" "The VTK_MAKE_INSTANTIATOR() command in CMake is used to automatically\n" "generate the creator registration for each VTK library. It can also\n" "be used to create registration code for VTK-style user libraries that\n" "are linked to vtkCommon. After using this command to register\n" "classes from a new library, the generated header must be included.\n\n"; static PyObject * PyvtkInstantiator_IsTypeOf(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "IsTypeOf"); char *temp0 = nullptr; PyObject *result = nullptr; if (ap.CheckArgCount(1) && ap.GetValue(temp0)) { int tempr = vtkInstantiator::IsTypeOf(temp0); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkInstantiator_IsA(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "IsA"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkInstantiator *op = static_cast(vp); char *temp0 = nullptr; PyObject *result = nullptr; if (op && ap.CheckArgCount(1) && ap.GetValue(temp0)) { int tempr = (ap.IsBound() ? op->IsA(temp0) : op->vtkInstantiator::IsA(temp0)); if (!ap.ErrorOccurred()) { result = ap.BuildValue(tempr); } } return result; } static PyObject * PyvtkInstantiator_SafeDownCast(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "SafeDownCast"); vtkObjectBase *temp0 = nullptr; PyObject *result = nullptr; if (ap.CheckArgCount(1) && ap.GetVTKObject(temp0, "vtkObjectBase")) { vtkInstantiator *tempr = vtkInstantiator::SafeDownCast(temp0); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); } } return result; } static PyObject * PyvtkInstantiator_NewInstance(PyObject *self, PyObject *args) { vtkPythonArgs ap(self, args, "NewInstance"); vtkObjectBase *vp = ap.GetSelfPointer(self, args); vtkInstantiator *op = static_cast(vp); PyObject *result = nullptr; if (op && ap.CheckArgCount(0)) { vtkInstantiator *tempr = (ap.IsBound() ? op->NewInstance() : op->vtkInstantiator::NewInstance()); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); if (result && PyVTKObject_Check(result)) { PyVTKObject_GetObject(result)->UnRegister(0); PyVTKObject_SetFlag(result, VTK_PYTHON_IGNORE_UNREGISTER, 1); } } } return result; } static PyObject * PyvtkInstantiator_CreateInstance(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "CreateInstance"); char *temp0 = nullptr; PyObject *result = nullptr; if (ap.CheckArgCount(1) && ap.GetValue(temp0)) { vtkObject *tempr = vtkInstantiator::CreateInstance(temp0); if (!ap.ErrorOccurred()) { result = ap.BuildVTKObject(tempr); if (result && PyVTKObject_Check(result)) { PyVTKObject_GetObject(result)->UnRegister(0); PyVTKObject_SetFlag(result, VTK_PYTHON_IGNORE_UNREGISTER, 1); } } } return result; } static PyMethodDef PyvtkInstantiator_Methods[] = { {"IsTypeOf", PyvtkInstantiator_IsTypeOf, METH_VARARGS, "V.IsTypeOf(string) -> int\nC++: static vtkTypeBool IsTypeOf(const char *type)\n\nReturn 1 if this class type is the same type of (or a subclass\nof) the named class. Returns 0 otherwise. This method works in\ncombination with vtkTypeMacro found in vtkSetGet.h.\n"}, {"IsA", PyvtkInstantiator_IsA, METH_VARARGS, "V.IsA(string) -> int\nC++: vtkTypeBool IsA(const char *type) override;\n\nReturn 1 if this class is the same type of (or a subclass of) the\nnamed class. Returns 0 otherwise. This method works in\ncombination with vtkTypeMacro found in vtkSetGet.h.\n"}, {"SafeDownCast", PyvtkInstantiator_SafeDownCast, METH_VARARGS, "V.SafeDownCast(vtkObjectBase) -> vtkInstantiator\nC++: static vtkInstantiator *SafeDownCast(vtkObjectBase *o)\n\n"}, {"NewInstance", PyvtkInstantiator_NewInstance, METH_VARARGS, "V.NewInstance() -> vtkInstantiator\nC++: vtkInstantiator *NewInstance()\n\n"}, {"CreateInstance", PyvtkInstantiator_CreateInstance, METH_VARARGS, "V.CreateInstance(string) -> vtkObject\nC++: static vtkObject *CreateInstance(const char *className)\n\nCreate an instance of the class whose name is given. If creation\nfails, a nullptr pointer is returned.\n"}, {nullptr, nullptr, 0, nullptr} }; static PyTypeObject PyvtkInstantiator_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "vtkCommonCorePython.vtkInstantiator", // tp_name sizeof(PyVTKObject), // tp_basicsize 0, // tp_itemsize PyVTKObject_Delete, // tp_dealloc 0, // tp_print nullptr, // tp_getattr nullptr, // tp_setattr nullptr, // tp_compare PyVTKObject_Repr, // tp_repr nullptr, // tp_as_number nullptr, // tp_as_sequence nullptr, // tp_as_mapping nullptr, // tp_hash nullptr, // tp_call PyVTKObject_String, // tp_str PyObject_GenericGetAttr, // tp_getattro PyObject_GenericSetAttr, // tp_setattro &PyVTKObject_AsBuffer, // tp_as_buffer Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_BASETYPE, // tp_flags PyvtkInstantiator_Doc, // tp_doc PyVTKObject_Traverse, // tp_traverse nullptr, // tp_clear nullptr, // tp_richcompare offsetof(PyVTKObject, vtk_weakreflist), // tp_weaklistoffset nullptr, // tp_iter nullptr, // tp_iternext nullptr, // tp_methods nullptr, // tp_members PyVTKObject_GetSet, // tp_getset nullptr, // tp_base nullptr, // tp_dict nullptr, // tp_descr_get nullptr, // tp_descr_set offsetof(PyVTKObject, vtk_dict), // tp_dictoffset nullptr, // tp_init nullptr, // tp_alloc PyVTKObject_New, // tp_new PyObject_GC_Del, // tp_free nullptr, // tp_is_gc nullptr, // tp_bases nullptr, // tp_mro nullptr, // tp_cache nullptr, // tp_subclasses nullptr, // tp_weaklist VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED }; static vtkObjectBase *PyvtkInstantiator_StaticNew() { return vtkInstantiator::New(); } PyObject *PyvtkInstantiator_ClassNew() { PyVTKClass_Add( &PyvtkInstantiator_Type, PyvtkInstantiator_Methods, "vtkInstantiator", &PyvtkInstantiator_StaticNew); PyTypeObject *pytype = &PyvtkInstantiator_Type; if ((pytype->tp_flags & Py_TPFLAGS_READY) != 0) { return (PyObject *)pytype; } #if !defined(VTK_PY3K) && PY_VERSION_HEX >= 0x02060000 pytype->tp_flags |= Py_TPFLAGS_HAVE_NEWBUFFER; #endif pytype->tp_base = (PyTypeObject *)PyvtkObject_ClassNew(); PyType_Ready(pytype); return (PyObject *)pytype; } static const char *PyvtkInstantiatorInitialize_Doc = "vtkInstantiatorInitialize - no description provided.\n\n" "vtkInstantiatorInitialize()\n"; static PyMethodDef PyvtkInstantiatorInitialize_Methods[] = { {nullptr, nullptr, 0, nullptr} }; static PyObject * PyvtkInstantiatorInitialize_vtkInstantiatorInitialize(PyObject *, PyObject *args) { vtkPythonArgs ap(args, "vtkInstantiatorInitialize"); PyObject *result = nullptr; if (ap.CheckArgCount(0)) { vtkInstantiatorInitialize *op = new vtkInstantiatorInitialize(); result = PyVTKSpecialObject_New("vtkInstantiatorInitialize", op); } return result; } static PyMethodDef PyvtkInstantiatorInitialize_vtkInstantiatorInitialize_Methods[] = { {nullptr, nullptr, 0, nullptr} }; static PyObject * PyvtkInstantiatorInitialize_New(PyTypeObject *, PyObject *args, PyObject *kwds) { if (kwds && PyDict_Size(kwds)) { PyErr_SetString(PyExc_TypeError, "this function takes no keyword arguments"); return nullptr; } return PyvtkInstantiatorInitialize_vtkInstantiatorInitialize(nullptr, args); } static void PyvtkInstantiatorInitialize_Delete(PyObject *self) { PyVTKSpecialObject *obj = (PyVTKSpecialObject *)self; delete static_cast(obj->vtk_ptr); PyObject_Del(self); } static Py_hash_t PyvtkInstantiatorInitialize_Hash(PyObject *self) { #if PY_VERSION_HEX >= 0x020600B2 return PyObject_HashNotImplemented(self); #else char text[256]; sprintf(text, "unhashable type: '%s'", Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_TypeError, text); return -1; #endif } static PyTypeObject PyvtkInstantiatorInitialize_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "vtkCommonCorePython.vtkInstantiatorInitialize", // tp_name sizeof(PyVTKSpecialObject), // tp_basicsize 0, // tp_itemsize PyvtkInstantiatorInitialize_Delete, // tp_dealloc 0, // tp_print nullptr, // tp_getattr nullptr, // tp_setattr nullptr, // tp_compare PyVTKSpecialObject_Repr, // tp_repr nullptr, // tp_as_number nullptr, // tp_as_sequence nullptr, // tp_as_mapping PyvtkInstantiatorInitialize_Hash, // tp_hash nullptr, // tp_call nullptr, // tp_str PyObject_GenericGetAttr, // tp_getattro nullptr, // tp_setattro nullptr, // tp_as_buffer Py_TPFLAGS_DEFAULT, // tp_flags PyvtkInstantiatorInitialize_Doc, // tp_doc nullptr, // tp_traverse nullptr, // tp_clear nullptr, // tp_richcompare 0, // tp_weaklistoffset nullptr, // tp_iter nullptr, // tp_iternext nullptr, // tp_methods nullptr, // tp_members nullptr, // tp_getset nullptr, // tp_base nullptr, // tp_dict nullptr, // tp_descr_get nullptr, // tp_descr_set 0, // tp_dictoffset nullptr, // tp_init nullptr, // tp_alloc PyvtkInstantiatorInitialize_New, // tp_new PyObject_Del, // tp_free nullptr, // tp_is_gc nullptr, // tp_bases nullptr, // tp_mro nullptr, // tp_cache nullptr, // tp_subclasses nullptr, // tp_weaklist VTK_WRAP_PYTHON_SUPPRESS_UNINITIALIZED }; extern "C" { VTK_ABI_EXPORT PyObject *PyvtkInstantiatorInitialize_TypeNew(); } PyObject *PyvtkInstantiatorInitialize_TypeNew() { PyVTKSpecialType_Add( &PyvtkInstantiatorInitialize_Type, PyvtkInstantiatorInitialize_Methods, PyvtkInstantiatorInitialize_vtkInstantiatorInitialize_Methods, nullptr); PyTypeObject *pytype = &PyvtkInstantiatorInitialize_Type; if ((pytype->tp_flags & Py_TPFLAGS_READY) != 0) { return (PyObject *)pytype; } PyType_Ready(pytype); return (PyObject *)pytype; } void PyVTKAddFile_vtkInstantiator( PyObject *dict) { PyObject *o; o = PyvtkInstantiator_ClassNew(); if (o && PyDict_SetItemString(dict, "vtkInstantiator", o) != 0) { Py_DECREF(o); } o = PyvtkInstantiatorInitialize_TypeNew(); if (o && PyDict_SetItemString(dict, "vtkInstantiatorInitialize", o) != 0) { Py_DECREF(o); } }