32 using namespace YACS::ENGINE;
37 DEBTRACE(
"data refcnt: " << data->ob_refcnt );
38 if (PyObject_HasAttrString(data, (
char*)
"_is_a"))
40 PyObject *result = PyObject_CallMethod(data, (
char*)
"_is_a", (
char*)
"s",(
char*)
"IDL:SALOME/GenericObj:1.0");
41 if(result && PyInt_Check(result))
43 if(PyInt_AS_LONG(result))
45 PyObject* o=PyObject_CallMethod(data, (
char*)
"Destroy", (
char*)
"");
55 throw ConversionException(
"Corba object does not exist: you have perhaps forgotten to call Register on a GenericObj");
67 throw ConversionException(
"Corba object does not exist: you have perhaps forgotten to call Register on a GenericObj");
74 if (PyObject_HasAttrString(data, (
char*)
"_is_a"))
76 PyObject *result = PyObject_CallMethod(data, (
char*)
"_is_a", (
char*)
"s",(
char*)
"IDL:SALOME/GenericObj:1.0");
77 if(result && PyInt_Check(result))
79 if(PyInt_AS_LONG(result))
81 PyObject* o= PyObject_CallMethod(data, (
char*)
"Register", (
char*)
"") ;
91 throw ConversionException(
"Corba object does not exist: you have perhaps forgotten to call Register on a GenericObj");
103 throw ConversionException(
"Corba object does not exist: you have perhaps forgotten to call Register on a GenericObj");
109 :
InputPort(name, node, type),
DataPort(name, node, type),
Port(node), _data(Py_None),_initData(Py_None)
116 PyGILState_STATE gstate = PyGILState_Ensure();
123 PyGILState_Release(gstate);
152 put((PyObject *)data);
164 DEBTRACE(
"_data refcnt: " << _data->ob_refcnt );
179 return (
void*)
_data;
186 PyObject* data=
_data;
201 char *val(PyString_AsString(ret));
210 return _data == Py_None;
220 PyGILState_STATE gstate = PyGILState_Ensure();
222 PyGILState_Release(gstate);
245 if(
_data == Py_None)
246 return "<value>None</value>";
265 int isString = PyString_Check(
getPyObj());
267 PyObject *strPyObj = PyObject_Str(
getPyObj());
269 string val = PyString_AsString(strPyObj);
271 val =
"\"" + val +
"\"";
290 PyGILState_STATE gstate = PyGILState_Ensure();
295 PyGILState_Release(gstate);
306 put((PyObject *)data);
312 DEBTRACE(
"OutputPyPort::put.ob refcnt: " << data->ob_refcnt );
314 PyObject_Print(data,stderr,Py_PRINT_RAW);
322 DEBTRACE(
"OutputPyPort::put.ob refcnt: " << data->ob_refcnt );
345 PyObject* data=
_data;
354 if(
_data == Py_None)
355 return "<value>None</value>";
363 PyObject *strPyObj = PyObject_Str(
getPyObj());
364 string val = PyString_AsString(strPyObj);