4 #include "ReceiverFactory.hxx"
8 #include "SALOME_Comm_i.hxx"
11 %typemap(python,in) SALOME::SenderDouble_ptr
13 PyObject* pdict = PyDict_New();
14 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
15 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
17 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
20 PyObject* orb = PyDict_GetItemString(pdict, "o");
22 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
24 PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input);
26 if (iorSupport == Py_None)
28 char * s = PyString_AsString(PyObject_Str(iorSupport));
30 // Ask omniORB to convert IOR string to SALOME::SenderDouble_ptr
35 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
36 CORBA::Object_var O = ORB->string_to_object(s);
37 SALOME::SenderDouble_ptr t = SALOME::SenderDouble::_narrow(O);
41 %typemap(python,in) SALOME::SenderInt_ptr
43 PyObject* pdict = PyDict_New();
44 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
45 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
47 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
50 PyObject* orb = PyDict_GetItemString(pdict, "o");
52 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
54 PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input);
56 if (iorSupport == Py_None)
58 char * s = PyString_AsString(PyObject_Str(iorSupport));
60 // Ask omniORB to convert IOR string to SALOME::SenderInt_ptr
65 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
66 CORBA::Object_var O = ORB->string_to_object(s);
67 SALOME::SenderInt_ptr t = SALOME::SenderInt::_narrow(O);
71 PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble);
74 PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble)
78 double *ret=ReceiverFactory::getValue(senderDouble,size);
79 py_list = PyList_New(size);
80 for (int i=0; i < size; i++)
82 int err = PyList_SetItem(py_list, i, Py_BuildValue("d", (double) ret[i]));
85 char * message = "Error in SUPPORT::getTypes";
86 PyErr_SetString(PyExc_RuntimeError, message);
90 PyObject * result = Py_BuildValue("O", py_list);
98 PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt);
101 PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt)
105 int *ret=ReceiverFactory::getValue(senderInt,size);
106 py_list = PyList_New(size);
107 for (int i=0; i < size; i++)
109 int err = PyList_SetItem(py_list, i, Py_BuildValue("i", (int) ret[i]));
112 char * message = "Error in SUPPORT::getTypes";
113 PyErr_SetString(PyExc_RuntimeError, message);
117 PyObject * result = Py_BuildValue("O", py_list);