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