1 // Copyright (C) 2006-2014 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "TypeConversions.hxx"
21 #include "NeutralPythonConv.hxx"
22 #include "RuntimeSALOME.hxx"
28 #include "YacsTrace.hxx"
30 using namespace YACS::ENGINE;
33 void NeutralPyDouble::put(const void *data) throw(ConversionException)
35 put((YACS::ENGINE::Any *)data);
38 //!Convert a YACS::ENGINE::Any (double) to a PyObject (PyFloat)
40 * \param data : YACS::ENGINE::Any object
42 void NeutralPyDouble::put(YACS::ENGINE::Any *data) throw(ConversionException)
44 InterpreterUnlocker loc;
45 PyObject* ob=convertNeutralPyObject(edGetType(),data);
46 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
52 void NeutralPyInt::put(const void *data) throw(ConversionException)
54 put((YACS::ENGINE::Any *)data);
57 //!Convert a YACS::ENGINE::Any (integer) to a PyObject (PyLong)
59 * \param data : YACS::ENGINE::Any object
61 void NeutralPyInt::put(YACS::ENGINE::Any *data) throw(ConversionException)
63 InterpreterUnlocker loc;
64 PyObject* ob=convertNeutralPyObject(edGetType(),data);
65 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
70 void NeutralPyString::put(const void *data) throw(ConversionException)
72 put((YACS::ENGINE::Any *)data);
75 //!Convert a YACS::ENGINE::Any (string) to a PyObject (PyString)
77 * \param data : YACS::ENGINE::Any object
79 void NeutralPyString::put(YACS::ENGINE::Any *data) throw(ConversionException)
81 InterpreterUnlocker loc;
82 PyObject* ob=convertNeutralPyObject(edGetType(),data);
83 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
88 void NeutralPyBool::put(const void *data) throw(ConversionException)
90 put((YACS::ENGINE::Any *)data);
93 //!Convert a YACS::ENGINE::Any (bool) to a PyObject (PyLong)
95 * \param data : YACS::ENGINE::Any object
97 void NeutralPyBool::put(YACS::ENGINE::Any *data) throw(ConversionException)
99 InterpreterUnlocker loc;
100 PyObject* ob=convertNeutralPyObject(edGetType(),data);
101 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
106 void NeutralPyObjref::put(const void *data) throw(ConversionException)
108 put((YACS::ENGINE::Any *)data);
111 //!Convert a Neutral::Any Objref to a PyObject Objref
113 * \param data : Neutral::Any object
115 void NeutralPyObjref::put(YACS::ENGINE::Any *data) throw(ConversionException)
117 InterpreterUnlocker loc;
118 PyObject* ob=convertNeutralPyObject(edGetType(),data);
119 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
122 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
125 void NeutralPySequence::put(const void *data) throw(ConversionException)
127 put((YACS::ENGINE::Any *)data);
130 //!Convert a Neutral::Any sequence to a PyObject Sequence
132 * \param data : Neutral::Any object
134 void NeutralPySequence::put(YACS::ENGINE::Any *data) throw(ConversionException)
136 DEBTRACE( "--------NeutralPySequence::put" );
137 InterpreterUnlocker loc;
138 PyObject* ob=convertNeutralPyObject(edGetType(),data);
139 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
141 cerr << "Sequence= ";
142 PyObject_Print(ob,stderr,Py_PRINT_RAW);
147 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
150 void NeutralPyStruct::put(const void *data) throw(ConversionException)
152 put((YACS::ENGINE::Any *)data);
155 //!Convert a Neutral::Any Struct to a PyObject Struct
157 * \param data : Neutral::Any object
159 void NeutralPyStruct::put(YACS::ENGINE::Any *data) throw(ConversionException)
161 InterpreterUnlocker loc;
162 PyObject* ob=convertNeutralPyObject(edGetType(),data);
163 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
166 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );