4 #include "ReceiverFactory.hxx"
5 #include "SALOME_Comm_i.hxx"
8 %typemap(python,in) SALOME::SenderDouble_ptr
10 PyObject* pdict = PyDict_New();
11 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
12 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
14 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
17 PyObject* orb = PyDict_GetItemString(pdict, "o");
19 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
21 PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input);
23 if (iorSupport == Py_None)
25 char * s = PyString_AsString(PyObject_Str(iorSupport));
27 // Ask omniORB to convert IOR string to SALOME::SenderDouble_ptr
32 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
33 CORBA::Object_var O = ORB->string_to_object(s);
34 SALOME::SenderDouble_ptr t = SALOME::SenderDouble::_narrow(O);
38 %typemap(python,in) SALOME::SenderInt_ptr
40 PyObject* pdict = PyDict_New();
41 PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
42 PyRun_String("import CORBA", Py_single_input, pdict, pdict);
44 PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
47 PyObject* orb = PyDict_GetItemString(pdict, "o");
49 // Ask omniORBpy to transform SUPPORT (python Corba) ptr to IOR string
51 PyObject* iorSupport = PyObject_CallMethod(orb, "object_to_string", "O", $input);
53 if (iorSupport == Py_None)
55 char * s = PyString_AsString(PyObject_Str(iorSupport));
57 // Ask omniORB to convert IOR string to SALOME::SenderInt_ptr
62 CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
63 CORBA::Object_var O = ORB->string_to_object(s);
64 SALOME::SenderInt_ptr t = SALOME::SenderInt::_narrow(O);
68 PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble);
71 PyObject * getValueForSenderDouble(SALOME::SenderDouble_ptr senderDouble)
75 double *ret=ReceiverFactory::getValue(senderDouble,size);
76 py_list = PyList_New(size);
77 for (int i=0; i < size; i++)
79 int err = PyList_SetItem(py_list, i, Py_BuildValue("d", (double) ret[i]));
82 char * message = "Error in SUPPORT::getTypes";
83 PyErr_SetString(PyExc_RuntimeError, message);
87 PyObject * result = Py_BuildValue("O", py_list);
95 PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt);
98 PyObject * getValueForSenderInt(SALOME::SenderInt_ptr senderInt)
102 int *ret=ReceiverFactory::getValue(senderInt,size);
103 py_list = PyList_New(size);
104 for (int i=0; i < size; i++)
106 int err = PyList_SetItem(py_list, i, Py_BuildValue("i", (int) ret[i]));
109 char * message = "Error in SUPPORT::getTypes";
110 PyErr_SetString(PyExc_RuntimeError, message);
114 PyObject * result = Py_BuildValue("O", py_list);