-
+// Copyright (C) 2006-2008 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
//#define REFCNT
+//
#ifdef REFCNT
#define private public
#define protected public
#include "TypeConversions.hxx"
#include "TypeCode.hxx"
#include "CORBAPorts.hxx"
+#include "PythonPorts.hxx"
#include "ServiceNode.hxx"
#include "ComponentInstance.hxx"
#include "SALOME_GenericObj.hh"
// make a copy of the any (protect against deletion of any source)
_data=*data;
+ _stringRef="";
registerObj(_data);
return &_data;
}
+PyObject * InputCorbaPort::getPyObj()
+{
+ CORBA::TypeCode_var tc=getAny()->type();
+ if (!tc->equivalent(CORBA::_tc_null))
+ return convertCorbaPyObject(edGetType(),getAny());
+ else
+ {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+
+std::string InputCorbaPort::getAsString()
+{
+ InterpreterUnlocker loc;
+ PyObject* ob=getPyObj();
+ std::string s=convertPyObjectToString(ob);
+ Py_DECREF(ob);
+ return s;
+}
+
+
//! Save the current data value for further reinitialization of the port
/*!
*
// }
}
+std::string InputCorbaPort::valToStr()
+{
+ int isString = PyString_Check(getPyObj());
+ PyObject *strPyObj = PyObject_Str(getPyObj());
+ string val = PyString_AsString(strPyObj);
+ if (isString)
+ val = "\"" + val + "\"";
+ Py_DECREF(strPyObj);
+ return val;
+}
+
+void InputCorbaPort::valFromStr(std::string valstr)
+{
+}
+
OutputCorbaPort::OutputCorbaPort(const std::string& name,
Node *node,
TypeCode * type)
return a;
}
+PyObject * OutputCorbaPort::getPyObj()
+{
+ CORBA::TypeCode_var tc=getAny()->type();
+ if (!tc->equivalent(CORBA::_tc_null))
+ return convertCorbaPyObject(edGetType(),getAny());
+ else
+ {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+
+std::string OutputCorbaPort::getAsString()
+{
+ InterpreterUnlocker loc;
+ PyObject* ob=getPyObj();
+ std::string s=convertPyObjectToString(ob);
+ Py_DECREF(ob);
+ return s;
+}
+
std::string OutputCorbaPort::dump()
{
CORBA::TypeCode_var tc=_data.type();
};
};
+std::string OutputCorbaPort::valToStr()
+{
+ PyObject *strPyObj = PyObject_Str(getPyObj());
+ string val = PyString_AsString(strPyObj);
+ Py_DECREF(strPyObj);
+ return val;
+}
+
+void OutputCorbaPort::valFromStr(std::string valstr)
+{
+}
+