Version: 9.16.0
CORBAPythonConv.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include "TypeConversions.hxx"
21#include "RuntimeSALOME.hxx"
22#include "CORBAPythonConv.hxx"
23#include "PythonPorts.hxx"
24
25#include <iostream>
26
27//#define _DEVDEBUG_
28#include "YacsTrace.hxx"
29
30using namespace YACS::ENGINE;
31using namespace std;
32
33CorbaPyDouble::CorbaPyDouble(InputPyPort* p)
34 : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
35{}
36
37void CorbaPyDouble::put(const void *data)
38{
39 put((CORBA::Any *)data);
40}
41
43
46void CorbaPyDouble::put(CORBA::Any *data)
47{
49 PyObject* ob=convertCorbaPyObject(edGetType(),data);
50 DEBTRACE("ob refcnt: " << ob->ob_refcnt );
51 _port->put(ob);
52 Py_DECREF(ob);
53}
54
55
57 : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
58{}
59
60void CorbaPyInt::put(const void *data)
61{
62 put((CORBA::Any *)data);
63}
64
66
69void CorbaPyInt::put(CORBA::Any *data)
70{
72 PyObject* ob=convertCorbaPyObject(edGetType(),data);
73 DEBTRACE("ob refcnt: " << ob->ob_refcnt );
74 _port->put(ob);
75 Py_DECREF(ob);
76}
77
79 : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
80{}
81void CorbaPyString::put(const void *data)
82{
83 put((CORBA::Any *)data);
84}
85
87
90void CorbaPyString::put(CORBA::Any *data)
91{
93 PyObject* ob=convertCorbaPyObject(edGetType(),data);
94 DEBTRACE("ob refcnt: " << ob->ob_refcnt );
95 _port->put(ob);
96 Py_DECREF(ob);
97}
98
100 : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
101{}
102
106void CorbaPyBool::put(const void *data)
107{
108 put((CORBA::Any *)data);
109}
110
112
115void CorbaPyBool::put(CORBA::Any *data)
116{
118 PyObject* ob=convertCorbaPyObject(edGetType(),data);
119 DEBTRACE("ob refcnt: " << ob->ob_refcnt );
120 _port->put(ob);
121 Py_DECREF(ob);
122}
123
125 : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
126{}
127
128void CorbaPyObjref::put(const void *data)
129{
130 put((CORBA::Any *)data);
131}
132
134
137void CorbaPyObjref::put(CORBA::Any *data)
138{
140 PyObject* ob=convertCorbaPyObject(edGetType(),data);
141 DEBTRACE("ob refcnt: " << ob->ob_refcnt );
142 _port->put(ob);
143 Py_DECREF(ob);
144}
145
147
151 : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
152{
154}
155
156void CorbaPySequence::put(const void *data)
157{
158 put((CORBA::Any *)data);
159}
160
162
165void CorbaPySequence::put(CORBA::Any *data)
166{
168 PyObject* ob=convertCorbaPyObject(edGetType(),data);
169 DEBTRACE("ob refcnt: " << ob->ob_refcnt );
170 _port->put(ob);
171 Py_DECREF(ob);
172}
173
175
179 : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
180{
181}
182
183void CorbaPyStruct::put(const void *data)
184{
185 put((CORBA::Any *)data);
186}
187
189
192void CorbaPyStruct::put(CORBA::Any *data)
193{
195 PyObject* ob=convertCorbaPyObject(edGetType(),data);
196 DEBTRACE("ob refcnt: " << ob->ob_refcnt );
197 _port->put(ob);
198 Py_DECREF(ob);
199}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
virtual void put(const void *data)
virtual void put(const void *data)
virtual void put(const void *data)
virtual void put(const void *data)
virtual void put(const void *data)
DynamicAny::DynAnyFactory_ptr _dynfactory
CorbaPySequence(InputPyPort *p)
Class to convert a CORBA::Any sequence to a PyObject Sequence.
virtual void put(const void *data)
virtual void put(const void *data)
CorbaPyStruct(InputPyPort *p)
Class to convert a CORBA::Any struct into a PyObject struct.
TypeCode * edGetType() const
Definition: DataPort.hxx:53
virtual void put(const void *data)=0
Class for Python Ports.
Definition: PythonPorts.hxx:74
Base class for all ports.
Definition: Port.hxx:43
Base class for Proxy Input Ports.
Definition: InputPort.hxx:100
DynamicAny::DynAnyFactory_ptr getDynFactory() const
Proc * p
Definition: driver.cxx:216
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()
PyObject * convertCorbaPyObject(const TypeCode *t, CORBA::Any *data)