Salome HOME
Implement shaperBuilder
[modules/shaper_study.git] / src / SWIG / StudyData_Swig.i
1
2
3 %module StudyData_Swig
4
5 %{
6 #include "StudyData_Object.h"
7 #include "StudyData_Operation.h"
8
9 #include <Standard_Failure.hxx>
10 #include <Standard_ErrorHandler.hxx>
11 #include <stdexcept>
12
13 static PyObject* setOCCException(Standard_Failure& ex)
14 {
15   std::string msg(ex.DynamicType()->Name());
16   if ( ex.GetMessageString() && strlen( ex.GetMessageString() )) {
17     msg += ": ";
18     msg += ex.GetMessageString();
19   }
20   PyErr_SetString(PyExc_Exception, msg.c_str() );
21   return NULL;
22 }
23 %}
24
25 %exception
26 {
27   try {
28     OCC_CATCH_SIGNALS;
29     $action }
30   catch (Standard_Failure& ex) {
31     return setOCCException(ex);
32   }
33   catch (std::exception& ex) {
34     PyErr_SetString(PyExc_Exception, ex.what() );
35     return NULL;
36   }
37 }
38
39 // standard definitions
40 %include "typemaps.i"
41 %include "std_string.i"
42 %include "std_list.i"
43
44 #define StudyData_EXPORT
45
46 %include "StudyData_Object.h"
47 %include "StudyData_Operation.h"
48
49 %template(LongList) std::list<long>;
50 %template(PtrsList) std::list<long long>;
51 %template(DoublList) std::list<double>;