//
+// ----------------------------------------------------------------------------
+
%module libSALOME_LifeCycleCORBA
+%include <std_except.i>
+
+
+// ----------------------------------------------------------------------------
+
%{
#include "utilities.h"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_FileTransferCORBA.hxx"
#include "SALOME_NamingService.hxx"
#include "ServiceUnreachable.hxx"
+#include "Utils_SALOME_Exception.hxx"
using namespace std;
%}
+// ----------------------------------------------------------------------------
+
+
%init
%{
// init section
%}
-%exception {
- try {
- $action
- }
- catch (ServiceUnreachable) {
- PyErr_SetString(PyExc_RuntimeError,"Naming Service Unreacheable");
- return NULL;
- }
- catch (...) {
- PyErr_SetString(PyExc_RuntimeError, "unknown exception");
- return NULL;
- }
-}
+// ----------------------------------------------------------------------------
%typemap(python,out) Engines::Container_ptr, Engines::Component_ptr, Engines::fileRef_ptr
{
SCRUTE($result);
}
+%typemap(python,in) Engines::fileRef_ptr aFileRef
+{
+ MESSAGE("typemap in on CORBA object ptr");
+ try {
+ CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1);
+ $1 = Engines::fileRef::_narrow(obj);
+ SCRUTE($1);
+ }
+ catch (...) {
+ PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr");
+ }
+}
+
+
%typemap(python,out) std::string,
string
{
delete $1;
}
-%include "SALOME_LifeCycleCORBA.hxx"
-%include "SALOME_FileTransferCORBA.hxx"
+// ----------------------------------------------------------------------------
+
+%include <Utils_SALOME_Exception.hxx>
+
+%exception {
+ PyThreadState *_save;
+ _save = PyEval_SaveThread();
+ try {
+ $action
+ }
+ catch (ServiceUnreachable) {
+ PyEval_RestoreThread(_save);
+ PyErr_SetString(PyExc_RuntimeError,"Naming Service Unreacheable");
+ return NULL;
+ }
+ catch (SALOME::SALOME_Exception &e) {
+ MESSAGE("catch SALOME exception");
+ //std::ostringstream os; os<<e;
+ PyEval_RestoreThread(_save);
+ //PyErr_SetString(PyExc_RuntimeError,os.str().c_str());
+ //PyErr_SetString(PyExc_RuntimeError,e.what());
+ SWIG_exception(SWIG_RuntimeError,"SALOME exception");
+ return NULL;
+ }
+ catch (...) {
+ PyEval_RestoreThread(_save);
+ PyErr_SetString(PyExc_RuntimeError, "unknown exception");
+ return NULL;
+ }
+ PyEval_RestoreThread(_save);
+}
+
+
+%include <SALOME_LifeCycleCORBA.hxx>
+%include <SALOME_FileTransferCORBA.hxx>
+