]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelHighAPI/ModelHighAPI.i
Salome HOME
30bb59da35246e02bc326bc065ac6813e9f73c26
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI.i
1 /* ModelHighAPI.i */
2 %module ModelHighAPI
3
4 %{
5   #include "ModelHighAPI_swig.h"
6 %}
7
8 %include "doxyhelp.i"
9
10 // import other modules
11 %import "ModelAPI.i"
12 %import "GeomDataAPI.i"
13
14 // to avoid error on this
15 #define MODELHIGHAPI_EXPORT
16
17 // standard definitions
18 %include "typemaps.i"
19 %include "std_list.i"
20 %include "std_string.i"
21 %include "std_shared_ptr.i"
22
23 // shared pointers
24 %shared_ptr(ModelHighAPI_Interface)
25
26 // typemaps
27
28 %typemap(in) const ModelHighAPI_Double & (ModelHighAPI_Double temp) {
29   if (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) {
30     temp = ModelHighAPI_Double(PyFloat_AsDouble($input));
31     $1 = &temp;
32   } else if (PyString_Check($input)) {
33     temp = ModelHighAPI_Double(PyString_AsString($input));
34     $1 = &temp;
35   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
36   } else {
37     PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Double, float, int or string.");
38     return NULL;
39   }
40 }
41 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Double, const ModelHighAPI_Double & {
42   $1 = (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input) || PyString_Check($input)) ? 1 : 0;
43 }
44
45 %typemap(in) const ModelHighAPI_Integer & (ModelHighAPI_Integer temp) {
46   if (PyInt_Check($input)) {
47     temp = ModelHighAPI_Integer(static_cast<int>(PyInt_AsLong($input)));
48     $1 = &temp;
49   } else if (PyString_Check($input)) {
50     temp = ModelHighAPI_Integer(PyString_AsString($input));
51     $1 = &temp;
52   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
53   } else {
54     PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Integer, int or string.");
55     return NULL;
56   }
57 }
58 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Integer, const ModelHighAPI_Integer & {
59   $1 = (PyInt_Check($input) || PyString_Check($input)) ? 1 : 0;
60 }
61
62 %typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) {
63   std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
64   std::shared_ptr<ModelAPI_Object> * temp_object;
65   int newmem = 0;
66   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
67     temp = ModelHighAPI_RefAttr(*temp_attribute);
68     if (newmem & SWIG_CAST_NEW_MEMORY) {
69       delete temp_attribute;
70     }
71     $1 = &temp;
72   } else
73   if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
74     temp = ModelHighAPI_RefAttr(*temp_object);
75     if (newmem & SWIG_CAST_NEW_MEMORY) {
76       delete temp_object;
77     }
78     $1 = &temp;
79   } else
80   if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
81   } else {
82     PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Double, float, int or string.");
83     return NULL;
84   }
85 }
86
87 // all supported interfaces
88 %include "ModelHighAPI_Double.h"
89 %include "ModelHighAPI_Integer.h"
90 %include "ModelHighAPI_Interface.h"
91 %include "ModelHighAPI_Macro.h"
92 %include "ModelHighAPI_RefAttr.h"
93 %include "ModelHighAPI_Selection.h"
94 %include "ModelHighAPI_Tools.h"