1 // ----------------------------------------------------------------------------
2 %define SALOMEDOCSTRING
3 "SALOMERuntime docstring
4 Implementation of nodes for SALOME platform."
7 %module(docstring=SALOMEDOCSTRING) SALOMERuntime
9 %feature("autodoc", "0");
12 // ----------------------------------------------------------------------------
15 #include "RuntimeSALOME.hxx"
16 #include "SALOMEDispatcher.hxx"
23 #include "utilities.h"
26 using namespace YACS::ENGINE;
28 //--- from omniORBpy.h (not present on Debian Sarge packages)
29 // (rename omniORBpyAPI in omniORBpy_API)
33 PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
34 CORBA::Boolean hold_lock);
35 // Convert a C++ object reference to a Python object reference.
36 // If <hold_lock> is true, caller holds the Python interpreter lock.
38 CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
39 CORBA::Boolean hold_lock);
40 // Convert a Python object reference to a C++ object reference.
41 // Raises BAD_PARAM if the Python object is not an object reference.
42 // If <hold_lock> is true, caller holds the Python interpreter lock.
46 // Constructor for the singleton. Sets up the function pointers.
54 // ----------------------------------------------------------------------------
61 PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
64 PyErr_SetString(PyExc_ImportError,
65 (char*)"Cannot import _omnipy");
68 PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
69 api = (omniORBpy_API*)PyCObject_AsVoidPtr(pyapi);
73 // ----------------------------------------------------------------------------
75 %typemap(python,out) YACSGui_ORB::Observer_ptr
77 MESSAGE("typemap out on CORBA object ptr");
79 $result = api->cxxObjRefToPyObjRef($1, 1);
83 %typemap(python,in) YACSGui_ORB::Observer_ptr
85 MESSAGE("typemap in on CORBA object ptr");
88 CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1);
89 $1 = YACSGui_ORB::Observer::_narrow(obj);
94 PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr");
98 // ----------------------------------------------------------------------------
104 class RuntimeSALOME: public Runtime
107 static void setRuntime(bool ispyext=false); // singleton creation
108 virtual ~RuntimeSALOME();
110 RuntimeSALOME(); // singleton
111 RuntimeSALOME(bool ispyext); // singleton
114 class SALOMEDispatcher: public Dispatcher
117 void addObserver(YACSGui_ORB::Observer_ptr observer,int numid, std::string event);
118 static void setSALOMEDispatcher();
119 static SALOMEDispatcher* getSALOMEDispatcher();