2 %module(directors="1") ModelHighAPI
3 %feature("director:except") {
6 std::cerr << std::endl;
7 throw Swig::DirectorMethodException();
12 #include "ModelHighAPI_swig.h"
14 // fix for SWIG v2.0.4
15 #define SWIGPY_SLICE_ARG(obj) ((PySliceObject*)(obj))
20 // import other modules
23 %import "GeomDataAPI.i"
25 // to avoid error on this
26 #define MODELHIGHAPI_EXPORT
28 // standard definitions
31 %include "std_string.i"
32 %include "std_shared_ptr.i"
35 %feature("director") ModelHighAPI_Dumper;
38 %shared_ptr(ModelHighAPI_Interface)
42 %typemap(in) const ModelHighAPI_Double & (ModelHighAPI_Double temp) {
43 if (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) {
44 temp = ModelHighAPI_Double(PyFloat_AsDouble($input));
46 } else if (PyString_Check($input)) {
47 temp = ModelHighAPI_Double(PyString_AsString($input));
49 } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
51 PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Double, float, int or string.");
55 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Double, const ModelHighAPI_Double & {
56 $1 = ((PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input) || PyString_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
59 %typemap(in) const ModelHighAPI_Integer & (ModelHighAPI_Integer temp) {
60 if (PyInt_Check($input)) {
61 temp = ModelHighAPI_Integer(static_cast<int>(PyInt_AsLong($input)));
63 } else if (PyString_Check($input)) {
64 temp = ModelHighAPI_Integer(PyString_AsString($input));
66 } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
68 PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Integer, int or string.");
72 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Integer, const ModelHighAPI_Integer & {
73 $1 = ((PyInt_Check($input) || PyString_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
76 %typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) {
77 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
78 std::shared_ptr<ModelAPI_Object> * temp_object;
79 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
81 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
82 if (!temp_attribute) {
83 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
86 temp = ModelHighAPI_RefAttr(*temp_attribute);
87 if (newmem & SWIG_CAST_NEW_MEMORY) {
88 delete temp_attribute;
92 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
94 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
97 temp = ModelHighAPI_RefAttr(*temp_object);
98 if (newmem & SWIG_CAST_NEW_MEMORY) {
103 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
104 if (!temp_interface) {
105 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
108 temp = ModelHighAPI_RefAttr(*temp_interface);
109 if (newmem & SWIG_CAST_NEW_MEMORY) {
110 delete temp_interface;
114 if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
116 PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
121 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_RefAttr, const ModelHighAPI_RefAttr & {
122 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
123 std::shared_ptr<ModelAPI_Object> * temp_object;
124 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
126 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
127 if (temp_attribute) {
132 } else if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
138 } else if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
139 if (temp_interface) {
149 %typemap(in) const ModelHighAPI_Reference & (ModelHighAPI_Reference temp) {
150 std::shared_ptr<ModelAPI_Object> * temp_object;
151 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
153 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
155 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface or ModelAPI_Object.");
158 temp = ModelHighAPI_Reference(*temp_object);
159 if (newmem & SWIG_CAST_NEW_MEMORY) {
164 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
165 if (!temp_interface) {
166 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface or ModelAPI_Object.");
169 temp = ModelHighAPI_Reference(*temp_interface);
170 if (newmem & SWIG_CAST_NEW_MEMORY) {
171 delete temp_interface;
175 if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
177 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface or ModelAPI_Object.");
182 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Reference, const ModelHighAPI_Reference & {
183 std::shared_ptr<ModelAPI_Object> * temp_object;
184 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
186 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
193 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
194 if (temp_interface) {
204 %typemap(out) const ModelHighAPI_Selection & {
205 $1_basetype * ptr = new $1_basetype(*$1);
206 $result = SWIG_NewPointerObj( (void*) ptr, $1_descriptor, 1 );
209 %typemap(out) const ModelHighAPI_Reference & {
210 $1_basetype * ptr = new $1_basetype(*$1);
211 $result = SWIG_NewPointerObj( (void*) ptr, $1_descriptor, 1 );
215 %template(SelectionList) std::list<ModelHighAPI_Selection>;
216 %template(RefAttrList) std::list<ModelHighAPI_RefAttr>;
217 %template(RefList) std::list<ModelHighAPI_Reference>;
220 // fix compilarion error: ‘res*’ was not declared in this scope
221 %typemap(freearg) const std::list<ModelHighAPI_RefAttr> & {}
222 %typemap(freearg) const std::list<std::shared_ptr<ModelAPI_Object> > & {}
224 %typemap(in) const std::list<ModelHighAPI_RefAttr> & (std::list<ModelHighAPI_RefAttr> temp) {
225 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
227 if (PySequence_Check($input)) {
228 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
229 PyObject * item = PySequence_GetItem($input, i);
230 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
231 if (!temp_attribute) {
232 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
235 temp.push_back(ModelHighAPI_RefAttr(*temp_attribute));
236 if (newmem & SWIG_CAST_NEW_MEMORY) {
237 delete temp_attribute;
244 PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
249 %typemap(in) const std::list<std::shared_ptr<ModelAPI_Object> > & (std::list<std::shared_ptr<ModelAPI_Object> > temp) {
250 std::shared_ptr<ModelAPI_Object> * temp_object;
251 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
253 if (PySequence_Check($input)) {
254 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
255 PyObject * item = PySequence_GetItem($input, i);
256 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
258 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
261 temp.push_back(*temp_object);
262 if (newmem & SWIG_CAST_NEW_MEMORY) {
266 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
267 if (!temp_interface) {
268 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
271 temp.push_back((*temp_interface)->defaultResult());
272 if (newmem & SWIG_CAST_NEW_MEMORY) {
273 delete temp_interface;
280 PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
285 %typecheck(SWIG_TYPECHECK_POINTER) std::list<std::shared_ptr<ModelAPI_Object> >, const std::list<std::shared_ptr<ModelAPI_Object> >& {
286 std::shared_ptr<ModelAPI_Object> * temp_object;
287 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
289 if (PySequence_Check($input)) {
290 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
291 PyObject * item = PySequence_GetItem($input, i);
292 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
300 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
301 if (temp_interface) {
315 // all supported interfaces
316 %include "ModelHighAPI_Double.h"
317 %include "ModelHighAPI_Dumper.h"
318 %include "ModelHighAPI_Integer.h"
319 %include "ModelHighAPI_Interface.h"
320 %include "ModelHighAPI_RefAttr.h"
321 %include "ModelHighAPI_Reference.h"
322 %include "ModelHighAPI_Selection.h"
323 %include "ModelHighAPI_Services.h"
324 %include "ModelHighAPI_Macro.h"
325 %include "ModelHighAPI_Tools.h"