]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelHighAPI/ModelHighAPI.i
Salome HOME
Add Integer attribute support
[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 // to avoid error on this
11 #define MODELHIGHAPI_EXPORT
12
13 // standard definitions
14 %include "typemaps.i"
15 %include "std_list.i"
16 %include "std_string.i"
17 %include "std_shared_ptr.i"
18
19 // shared pointers
20 %shared_ptr(ModelHighAPI_Interface)
21
22 // typemaps
23
24 %typemap(in) const ModelHighAPI_Double & (ModelHighAPI_Double temp) {
25   if (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) {
26     temp = ModelHighAPI_Double(PyFloat_AsDouble($input));
27     $1 = &temp;
28   } else if (PyString_Check($input)) {
29     temp = ModelHighAPI_Double(PyString_AsString($input));
30     $1 = &temp;
31   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
32   } else {
33     PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Double, float, int or string.");
34     return NULL;
35   }
36 }
37
38 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Double, const ModelHighAPI_Double & {
39   $1 = (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input) || PyString_Check($input)) ? 1 : 0;
40 }
41
42 %typemap(in) const ModelHighAPI_Integer & (ModelHighAPI_Integer temp) {
43   if (PyInt_Check($input)) {
44     temp = ModelHighAPI_Integer(static_cast<int>(PyInt_AsLong($input)));
45     $1 = &temp;
46   } else if (PyString_Check($input)) {
47     temp = ModelHighAPI_Integer(PyString_AsString($input));
48     $1 = &temp;
49   } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
50   } else {
51     PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Integer, int or string.");
52     return NULL;
53   }
54 }
55
56 %typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Integer, const ModelHighAPI_Integer & {
57   $1 = (PyInt_Check($input) || PyString_Check($input)) ? 1 : 0;
58 }
59
60 // all supported interfaces
61 %include "ModelHighAPI_Double.h"
62 %include "ModelHighAPI_Integer.h"
63 %include "ModelHighAPI_Interface.h"
64 %include "ModelHighAPI_Macro.h"
65 %include "ModelHighAPI_Selection.h"
66 %include "ModelHighAPI_Tools.h"
67
68 // std::list -> []
69 %template(SelectionList) std::list<ModelHighAPI_Selection>;