Salome HOME
Add GeomAPI to ModelHighAPI and others
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI.i
1 /* ModelHighAPI.i */
2 %module ModelHighAPI
3
4 %{
5   #include "ModelHighAPI_swig.h"
6
7   // fix for SWIG v2.0.4
8   #define SWIGPY_SLICE_ARG(obj) ((PySliceObject*)(obj))
9 %}
10
11 %include "doxyhelp.i"
12
13 // import other modules
14 %import "GeomAPI.i"
15 %import "ModelAPI.i"
16 %import "GeomDataAPI.i"
17
18 // to avoid error on this
19 #define MODELHIGHAPI_EXPORT
20
21 // standard definitions
22 %include "typemaps.i"
23 %include "std_list.i"
24 %include "std_string.i"
25 %include "std_shared_ptr.i"
26
27 // shared pointers
28 %shared_ptr(ModelHighAPI_Interface)
29
30 // typemaps
31
32 %typemap(in) const ModelHighAPI_Double & (ModelHighAPI_Double temp) {
33   if (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) {
34     temp = ModelHighAPI_Double(PyFloat_AsDouble($input));
35     $1 = &temp;
36   } else if (PyString_Check($input)) {
37     temp = ModelHighAPI_Double(PyString_AsString($input));
38     $1 = &temp;
39   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
40   } else {
41     PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Double, float, int or string.");
42     return NULL;
43   }
44 }
45 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Double, const ModelHighAPI_Double & {
46   $1 = (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input) || PyString_Check($input)) ? 1 : 0;
47 }
48
49 %typemap(in) const ModelHighAPI_Integer & (ModelHighAPI_Integer temp) {
50   if (PyInt_Check($input)) {
51     temp = ModelHighAPI_Integer(static_cast<int>(PyInt_AsLong($input)));
52     $1 = &temp;
53   } else if (PyString_Check($input)) {
54     temp = ModelHighAPI_Integer(PyString_AsString($input));
55     $1 = &temp;
56   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
57   } else {
58     PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Integer, int or string.");
59     return NULL;
60   }
61 }
62 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Integer, const ModelHighAPI_Integer & {
63   $1 = (PyInt_Check($input) || PyString_Check($input)) ? 1 : 0;
64 }
65
66 %typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) {
67   std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
68   std::shared_ptr<ModelAPI_Object> * temp_object;
69   std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
70   int newmem = 0;
71   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
72     if (!temp_attribute) {
73       PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
74       return NULL;
75     }
76     temp = ModelHighAPI_RefAttr(*temp_attribute);
77     if (newmem & SWIG_CAST_NEW_MEMORY) {
78       delete temp_attribute;
79     }
80     $1 = &temp;
81   } else
82   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
83     if (!temp_object) {
84       PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
85       return NULL;
86     }
87     temp = ModelHighAPI_RefAttr(*temp_object);
88     if (newmem & SWIG_CAST_NEW_MEMORY) {
89       delete temp_object;
90     }
91     $1 = &temp;
92   } else
93   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
94     if (!temp_interface) {
95       PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
96       return NULL;
97     }
98     temp = ModelHighAPI_RefAttr(*temp_interface);
99     if (newmem & SWIG_CAST_NEW_MEMORY) {
100       delete temp_interface;
101     }
102     $1 = &temp;
103   } else
104   if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
105   } else {
106     PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
107     return NULL;
108   }
109 }
110
111 // all supported interfaces
112 %include "ModelHighAPI_Double.h"
113 %include "ModelHighAPI_Integer.h"
114 %include "ModelHighAPI_Interface.h"
115 %include "ModelHighAPI_RefAttr.h"
116 %include "ModelHighAPI_Selection.h"
117 %include "ModelHighAPI_Macro.h"
118 %include "ModelHighAPI_Tools.h"
119
120 %template(SelectionList) std::list<ModelHighAPI_Selection>;