Salome HOME
Fronttrack
[modules/homard.git] / src / FrontTrack_SWIG / FrontTrack.i
1 // File      : FrontTrack.i
2 // Created   : Fri Apr 28 17:36:20 2017
3 // Author    : Edward AGAPOV (eap)
4
5 %module FrontTrack
6
7 %{
8 #include "FrontTrack.hxx"
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
26
27 %exception
28 {
29   try {
30     OCC_CATCH_SIGNALS;
31     $action }
32   catch (Standard_Failure& ex) {
33     return setOCCException(ex);
34   }
35   catch (std::exception& ex) {
36     PyErr_SetString(PyExc_Exception, ex.what() );
37     return NULL;
38   }
39 }
40
41 %include <std_string.i>
42 %include <std_vector.i>
43
44 %template(svec) std::vector<std::string>;
45
46 //%feature("autodoc", "1");
47 //%feature("docstring");
48
49 %include "FrontTrack.hxx"