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
32 %include "std_string.i"
33 %include "std_shared_ptr.i"
36 %feature("director") ModelHighAPI_Dumper;
39 %shared_ptr(ModelHighAPI_Interface)
43 %typemap(in) const ModelHighAPI_Double & (ModelHighAPI_Double temp) {
44 if (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) {
45 temp = ModelHighAPI_Double(PyFloat_AsDouble($input));
47 } else if (PyString_Check($input)) {
48 temp = ModelHighAPI_Double(PyString_AsString($input));
50 } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
52 PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Double, float, int or string.");
56 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Double, const ModelHighAPI_Double & {
57 $1 = ((PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input) || PyString_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
60 %typemap(in) const ModelHighAPI_Integer & (ModelHighAPI_Integer temp) {
61 if (PyInt_Check($input)) {
62 temp = ModelHighAPI_Integer(static_cast<int>(PyInt_AsLong($input)));
64 } else if (PyString_Check($input)) {
65 temp = ModelHighAPI_Integer(PyString_AsString($input));
67 } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
69 PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Integer, int or string.");
73 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Integer, const ModelHighAPI_Integer & {
74 $1 = ((PyInt_Check($input) || PyString_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
77 %typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) {
78 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
79 std::shared_ptr<ModelAPI_Object> * temp_object;
80 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
82 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
83 if (!temp_attribute) {
84 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
87 temp = ModelHighAPI_RefAttr(*temp_attribute);
88 if (newmem & SWIG_CAST_NEW_MEMORY) {
89 delete temp_attribute;
93 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
95 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
98 temp = ModelHighAPI_RefAttr(*temp_object);
99 if (newmem & SWIG_CAST_NEW_MEMORY) {
104 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
105 if (!temp_interface) {
106 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
109 temp = ModelHighAPI_RefAttr(*temp_interface);
110 if (newmem & SWIG_CAST_NEW_MEMORY) {
111 delete temp_interface;
115 if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
117 PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
122 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_RefAttr, const ModelHighAPI_RefAttr & {
123 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
124 std::shared_ptr<ModelAPI_Object> * temp_object;
125 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
127 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
128 if (temp_attribute) {
133 } else if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
139 } else if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
140 if (temp_interface) {
150 %typemap(in) const ModelHighAPI_Reference & (ModelHighAPI_Reference temp) {
151 std::shared_ptr<ModelAPI_Object> * temp_object;
152 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
154 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
156 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface or ModelAPI_Object.");
159 temp = ModelHighAPI_Reference(*temp_object);
160 if (newmem & SWIG_CAST_NEW_MEMORY) {
165 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
166 if (!temp_interface) {
167 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface or ModelAPI_Object.");
170 temp = ModelHighAPI_Reference(*temp_interface);
171 if (newmem & SWIG_CAST_NEW_MEMORY) {
172 delete temp_interface;
176 if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
178 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Interface or ModelAPI_Object.");
183 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Reference, const ModelHighAPI_Reference & {
184 std::shared_ptr<ModelAPI_Object> * temp_object;
185 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
187 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
194 if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
195 if (temp_interface) {
205 %typemap(out) const ModelHighAPI_Selection & {
206 $1_basetype * ptr = new $1_basetype(*$1);
207 $result = SWIG_NewPointerObj( (void*) ptr, $1_descriptor, 1 );
210 %typemap(out) const ModelHighAPI_Reference & {
211 $1_basetype * ptr = new $1_basetype(*$1);
212 $result = SWIG_NewPointerObj( (void*) ptr, $1_descriptor, 1 );
216 %template(SelectionList) std::list<ModelHighAPI_Selection>;
217 %template(RefAttrList) std::list<ModelHighAPI_RefAttr>;
218 %template(RefList) std::list<ModelHighAPI_Reference>;
221 %template(ResultSubShapePair) std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >;
224 // fix compilarion error: ‘res*’ was not declared in this scope
225 %typemap(freearg) const std::list<ModelHighAPI_RefAttr> & {}
226 %typemap(freearg) const std::list<std::shared_ptr<ModelAPI_Object> > & {}
228 %typemap(in) const std::list<ModelHighAPI_RefAttr> & (std::list<ModelHighAPI_RefAttr> temp) {
229 std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
231 if (PySequence_Check($input)) {
232 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
233 PyObject * item = PySequence_GetItem($input, i);
234 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
235 if (!temp_attribute) {
236 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
239 temp.push_back(ModelHighAPI_RefAttr(*temp_attribute));
240 if (newmem & SWIG_CAST_NEW_MEMORY) {
241 delete temp_attribute;
248 PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
253 %typemap(in) const std::list<std::shared_ptr<ModelAPI_Object> > & (std::list<std::shared_ptr<ModelAPI_Object> > temp) {
254 std::shared_ptr<ModelAPI_Object> * temp_object;
255 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
257 if (PySequence_Check($input)) {
258 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
259 PyObject * item = PySequence_GetItem($input, i);
260 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
262 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
265 temp.push_back(*temp_object);
266 if (newmem & SWIG_CAST_NEW_MEMORY) {
270 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
271 if (!temp_interface) {
272 PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
275 temp.push_back((*temp_interface)->defaultResult());
276 if (newmem & SWIG_CAST_NEW_MEMORY) {
277 delete temp_interface;
284 PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
289 %typecheck(SWIG_TYPECHECK_POINTER) std::list<std::shared_ptr<ModelAPI_Object> >, const std::list<std::shared_ptr<ModelAPI_Object> >& {
290 std::shared_ptr<ModelAPI_Object> * temp_object;
291 std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
293 if (PySequence_Check($input)) {
294 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
295 PyObject * item = PySequence_GetItem($input, i);
296 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
304 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
305 if (temp_interface) {
319 // all supported interfaces
320 %include "ModelHighAPI_Double.h"
321 %include "ModelHighAPI_Dumper.h"
322 %include "ModelHighAPI_Integer.h"
323 %include "ModelHighAPI_Interface.h"
324 %include "ModelHighAPI_RefAttr.h"
325 %include "ModelHighAPI_Reference.h"
326 %include "ModelHighAPI_Selection.h"
327 %include "ModelHighAPI_Services.h"
328 %include "ModelHighAPI_Macro.h"
329 %include "ModelHighAPI_Tools.h"