1 // Copyright (C) 2006-2008 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.
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
19 #include "TypeConversions.hxx"
20 #include "NeutralPythonConv.hxx"
21 #include "RuntimeSALOME.hxx"
27 #include "YacsTrace.hxx"
29 using namespace YACS::ENGINE;
32 void NeutralPyDouble::put(const void *data) throw(ConversionException)
34 put((YACS::ENGINE::Any *)data);
37 //!Convert a YACS::ENGINE::Any (double) to a PyObject (PyFloat)
39 * \param data : YACS::ENGINE::Any object
41 void NeutralPyDouble::put(YACS::ENGINE::Any *data) throw(ConversionException)
43 InterpreterUnlocker loc;
44 PyObject* ob=convertNeutralPyObject(edGetType(),data);
45 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
51 void NeutralPyInt::put(const void *data) throw(ConversionException)
53 put((YACS::ENGINE::Any *)data);
56 //!Convert a YACS::ENGINE::Any (integer) to a PyObject (PyLong)
58 * \param data : YACS::ENGINE::Any object
60 void NeutralPyInt::put(YACS::ENGINE::Any *data) throw(ConversionException)
62 InterpreterUnlocker loc;
63 PyObject* ob=convertNeutralPyObject(edGetType(),data);
64 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
69 void NeutralPyString::put(const void *data) throw(ConversionException)
71 put((YACS::ENGINE::Any *)data);
74 //!Convert a YACS::ENGINE::Any (string) to a PyObject (PyString)
76 * \param data : YACS::ENGINE::Any object
78 void NeutralPyString::put(YACS::ENGINE::Any *data) throw(ConversionException)
80 InterpreterUnlocker loc;
81 PyObject* ob=convertNeutralPyObject(edGetType(),data);
82 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
87 void NeutralPyBool::put(const void *data) throw(ConversionException)
89 put((YACS::ENGINE::Any *)data);
92 //!Convert a YACS::ENGINE::Any (bool) to a PyObject (PyLong)
94 * \param data : YACS::ENGINE::Any object
96 void NeutralPyBool::put(YACS::ENGINE::Any *data) throw(ConversionException)
98 InterpreterUnlocker loc;
99 PyObject* ob=convertNeutralPyObject(edGetType(),data);
100 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
105 void NeutralPyObjref::put(const void *data) throw(ConversionException)
107 put((YACS::ENGINE::Any *)data);
110 //!Convert a Neutral::Any Objref to a PyObject Objref
112 * \param data : Neutral::Any object
114 void NeutralPyObjref::put(YACS::ENGINE::Any *data) throw(ConversionException)
116 InterpreterUnlocker loc;
117 PyObject* ob=convertNeutralPyObject(edGetType(),data);
118 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
121 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
124 void NeutralPySequence::put(const void *data) throw(ConversionException)
126 put((YACS::ENGINE::Any *)data);
129 //!Convert a Neutral::Any sequence to a PyObject Sequence
131 * \param data : Neutral::Any object
133 void NeutralPySequence::put(YACS::ENGINE::Any *data) throw(ConversionException)
135 DEBTRACE( "--------NeutralPySequence::put" );
136 InterpreterUnlocker loc;
137 PyObject* ob=convertNeutralPyObject(edGetType(),data);
138 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
140 cerr << "Sequence= ";
141 PyObject_Print(ob,stderr,Py_PRINT_RAW);
146 DEBTRACE( "ob refcnt: " << ob->ob_refcnt );