Version: 9.16.0
PythonPorts.cxx File Reference
#include "PythonPorts.hxx"
#include "TypeConversions.hxx"
#include "TypeCode.hxx"
#include "Node.hxx"
#include "ConversionException.hxx"
#include <iostream>
#include <sstream>
#include "YacsTrace.hxx"
Include dependency graph for PythonPorts.cxx:

Go to the source code of this file.

Functions

static void RegisterReleasePyObj (PyObject *data, const char *method1)
 
void releasePyObj (PyObject *data)
 
void registerPyObj (PyObject *data)
 

Function Documentation

◆ registerPyObj()

void registerPyObj ( PyObject *  data)

Definition at line 79 of file PythonPorts.cxx.

80{
81 RegisterReleasePyObj(data,"Register");
82}
static void RegisterReleasePyObj(PyObject *data, const char *method1)
Definition: PythonPorts.cxx:35

References RegisterReleasePyObj().

Referenced by YACS::ENGINE::InputPyPort::put().

◆ RegisterReleasePyObj()

static void RegisterReleasePyObj ( PyObject *  data,
const char *  method1 
)
static

Definition at line 35 of file PythonPorts.cxx.

36{
37 if(!data)
38 return ;
39 DEBTRACE( "data refcnt: " << data->ob_refcnt );
40 if (PyObject_HasAttrString(data, (char*)"_is_a"))
41 {
42 PyObject *result = PyObject_CallMethod(data, (char*)"_is_a", (char*)"s",(char*)"IDL:SALOME/GenericObj:1.0");
43 if(result && PyLong_Check(result))
44 {
45 if(PyLong_AS_LONG(result))
46 {
47 PyObject* o=PyObject_CallMethod(data, (char*)method1, (char*)"");
48 if(o)
49 Py_XDECREF( o);
50 else
51 {
52#ifdef _DEVDEBUG_
53 PyErr_Print();
54#else
55 PyErr_Clear();
56#endif
57 throw ConversionException("Corba object does not exist: you have perhaps forgotten to call Register on a GenericObj");
58 }
59 }
60 Py_XDECREF(result);
61 }
62 if(!result)
63 {
64#ifdef _DEVDEBUG_
65 PyErr_Print();
66#else
67 PyErr_Clear();
68#endif
69 throw ConversionException("Corba object does not exist: you have perhaps forgotten to call Register on a GenericObj");
70 }
71 }
72}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31

References DEBTRACE.

Referenced by registerPyObj(), and releasePyObj().

◆ releasePyObj()