]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModelHighAPI/ModelHighAPI.i
Salome HOME
Add Integer attribute support
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI.i
index 63199a34b4957b1afa32ee4c89dbea6f6b1d186d..f8d01f872eb1544d156e585f2dfe208065a81416 100644 (file)
@@ -20,6 +20,7 @@
 %shared_ptr(ModelHighAPI_Interface)
 
 // typemaps
+
 %typemap(in) const ModelHighAPI_Double & (ModelHighAPI_Double temp) {
   if (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) {
     temp = ModelHighAPI_Double(PyFloat_AsDouble($input));
   $1 = (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input) || PyString_Check($input)) ? 1 : 0;
 }
 
+%typemap(in) const ModelHighAPI_Integer & (ModelHighAPI_Integer temp) {
+  if (PyInt_Check($input)) {
+    temp = ModelHighAPI_Integer(static_cast<int>(PyInt_AsLong($input)));
+    $1 = &temp;
+  } else if (PyString_Check($input)) {
+    temp = ModelHighAPI_Integer(PyString_AsString($input));
+    $1 = &temp;
+  } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
+  } else {
+    PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Integer, int or string.");
+    return NULL;
+  }
+}
+
+%typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Integer, const ModelHighAPI_Integer & {
+  $1 = (PyInt_Check($input) || PyString_Check($input)) ? 1 : 0;
+}
+
 // all supported interfaces
 %include "ModelHighAPI_Double.h"
+%include "ModelHighAPI_Integer.h"
 %include "ModelHighAPI_Interface.h"
 %include "ModelHighAPI_Macro.h"
 %include "ModelHighAPI_Selection.h"