Version: 9.16.0
NeutralPythonConv.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 "NeutralPythonConv.hxx"
22#include "RuntimeSALOME.hxx"
23
24#include <iostream>
25#include <string>
26
27//#define _DEVDEBUG_
28#include "YacsTrace.hxx"
29
30using namespace YACS::ENGINE;
31using namespace std;
32
33void NeutralPyDouble::put(const void *data)
34{
35 put((YACS::ENGINE::Any *)data);
36}
37
39
43{
45 PyObject* ob=convertNeutralPyObject(edGetType(),data);
46 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
47 _port->put(ob);
48 Py_DECREF(ob);
49}
50
51
52void NeutralPyInt::put(const void *data)
53{
54 put((YACS::ENGINE::Any *)data);
55}
56
58
62{
64 PyObject* ob=convertNeutralPyObject(edGetType(),data);
65 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
66 _port->put(ob);
67 Py_DECREF(ob);
68}
69
70void NeutralPyString::put(const void *data)
71{
72 put((YACS::ENGINE::Any *)data);
73}
74
76
80{
82 PyObject* ob=convertNeutralPyObject(edGetType(),data);
83 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
84 _port->put(ob);
85 Py_DECREF(ob);
86}
87
88void NeutralPyBool::put(const void *data)
89{
90 put((YACS::ENGINE::Any *)data);
91}
92
94
98{
100 PyObject* ob=convertNeutralPyObject(edGetType(),data);
101 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
102 _port->put(ob);
103 Py_DECREF(ob);
104}
105
106void NeutralPyObjref::put(const void *data)
107{
108 put((YACS::ENGINE::Any *)data);
109}
110
112
116{
118 PyObject* ob=convertNeutralPyObject(edGetType(),data);
119 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
120 _port->put(ob);
121 Py_DECREF(ob);
122 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
123}
124
125void NeutralPySequence::put(const void *data)
126{
127 put((YACS::ENGINE::Any *)data);
128}
129
131
135{
136 DEBTRACE( "--------NeutralPySequence::put" );
138 PyObject* ob=convertNeutralPyObject(edGetType(),data);
139 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
140#ifdef _DEVDEBUG_
141 cerr << "Sequence= ";
142 PyObject_Print(ob,stderr,Py_PRINT_RAW);
143 cerr << endl;
144#endif
145 _port->put(ob);
146 Py_DECREF(ob);
147 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
148}
149
150void NeutralPyStruct::put(const void *data)
151{
152 put((YACS::ENGINE::Any *)data);
153}
154
156
160{
162 PyObject* ob=convertNeutralPyObject(edGetType(),data);
163 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
164 _port->put(ob);
165 Py_DECREF(ob);
166 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
167}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
TypeCode * edGetType() const
Definition: DataPort.hxx:53
virtual void put(const void *data)=0
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)
virtual void put(const void *data)
virtual void put(const void *data)
PyObject * convertNeutralPyObject(const TypeCode *t, YACS::ENGINE::Any *data)