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