Salome HOME
Merge branch 'V7_dev'
[modules/yacs.git] / src / runtime / TypeConversions.hxx
index a26496594023f82619c50052daaaf6436ee8b1b9..cd3a330a1d5eab5ba36b1bf29b5e8d9861b455b1 100644 (file)
@@ -1,51 +1,88 @@
+// Copyright (C) 2006-2016  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, or (at your option) any later version.
+//
+// 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
+//
 
 #ifndef _TYPECONVERSIONS_HXX_
 #define _TYPECONVERSIONS_HXX_
 
+#include "YACSRuntimeSALOMEExport.hxx"
+
 #include <Python.h>
 #include <omniORB4/CORBA.h>
 #include <libxml/parser.h>
-
-#include "TypeCode.hxx"
+#include <string>
 
 namespace YACS
 {
   namespace ENGINE
   {
 
-    typedef CORBA::TypeCode_ptr (*getCorbaTCFn)(TypeCode *);
-    CORBA::TypeCode_ptr getCorbaTC(TypeCode *t);
-
-    typedef CORBA::Any* (*convertCorbaPyObjectFn)(TypeCode *,PyObject* );
-    CORBA::Any *convertCorbaPyObject(TypeCode *t,PyObject *ob);
-
-    typedef int (*isAdaptableCorbaPyObjectFn)(TypeCode *,TypeCode* );
-    int isAdaptableCorbaPyObject(TypeCode* t1,TypeCode* t2);
-
-    typedef int (*isAdaptableXmlCorbaFn)(TypeCode *,TypeCode* );
-    int isAdaptableXmlCorba(TypeCode *t1,TypeCode *t2);
-
-    typedef int (*isAdaptableCorbaCorbaFn)(TypeCode *,TypeCode* );
-    int isAdaptableCorbaCorba(TypeCode* t1,TypeCode* t2);
-
-    typedef int (*isAdaptablePyObjectPyObjectFn)(TypeCode *,TypeCode* );
-    int isAdaptablePyObjectPyObject(TypeCode* t1,TypeCode* t2);
-
-    typedef int (*isAdaptablePyObjectCorbaFn)(TypeCode *,TypeCode* );
-    int isAdaptablePyObjectCorba(TypeCode* t1,TypeCode* t2);
-
-    typedef PyObject* (*convertPyObjectCorbaFn)(TypeCode *,CORBA::Any* );
-    PyObject *convertPyObjectCorba(TypeCode* t,CORBA::Any* ob);
-
-    typedef char* (*convertXmlCorbaFn)(TypeCode *,CORBA::Any* );
-    char *convertXmlCorba(TypeCode* t,CORBA::Any* ob);
-
-    typedef CORBA::Any* (*convertCorbaCorbaFn)(TypeCode *,CORBA::Any* );
-    CORBA::Any *convertCorbaCorba(TypeCode* t,CORBA::Any* ob);
-
-    typedef CORBA::Any* (*convertCorbaXmlFn)(TypeCode *,xmlDocPtr doc,xmlNodePtr cur);
-    CORBA::Any *convertCorbaXml(TypeCode* t,xmlDocPtr doc,xmlNodePtr cur );
-
+    typedef enum
+      {
+        CORBAImpl    = 1,
+        PYTHONImpl   = 2,
+        NEUTRALImpl  = 3,
+        XMLImpl      = 4,
+        CPPImpl      = 5,
+      } ImplType;
+
+    class TypeCode;
+    class Any;
+
+    CORBA::TypeCode_ptr getCorbaTC(const TypeCode *t);
+
+    int isAdaptableCorbaPyObject(const TypeCode * t1, const TypeCode * t2);
+    int isAdaptableCorbaNeutral(const TypeCode * t1, const TypeCode * t2);
+    int isAdaptableCorbaCorba(const TypeCode * t1, const TypeCode * t2);
+
+    int isAdaptableNeutralCorba(const TypeCode * t1, const TypeCode * t2);
+    int isAdaptableNeutralNeutral(const TypeCode * t1, const TypeCode * t2);
+    int isAdaptableNeutralXml(const TypeCode * t1, const TypeCode * t2);
+    int isAdaptableNeutralPyObject(const TypeCode * t1, const TypeCode * t2);
+
+    int isAdaptablePyObjectPyObject(const TypeCode * t1, const TypeCode * t2);
+    int isAdaptablePyObjectCorba(const TypeCode * t1, const TypeCode * t2);
+    int isAdaptablePyObjectNeutral(const TypeCode * t1, const TypeCode * t2);
+
+    int isAdaptableXmlNeutral(const TypeCode *t1,const TypeCode *t2);
+    int isAdaptableXmlCorba(const TypeCode *t1, const TypeCode *t2);
+
+    PyObject *convertCorbaPyObject(const TypeCode * t,CORBA::Any* ob);
+    CORBA::Any *convertCorbaCorba(const TypeCode * t,CORBA::Any* ob);
+    YACS::ENGINE::Any *convertCorbaNeutral(const TypeCode *t,CORBA::Any* ob);
+    std::string convertCorbaXml(const TypeCode * t,CORBA::Any* ob);
+
+    CORBA::Any *convertPyObjectCorba(const TypeCode *t,PyObject *ob);
+    YACSRUNTIMESALOME_EXPORT std::string convertPyObjectXml(const TypeCode * t,PyObject* ob);
+    YACS::ENGINE::Any *convertPyObjectNeutral(const TypeCode *t,PyObject* ob);
+    PyObject* convertPyObjectPyObject(const TypeCode *t,PyObject *ob);
+    std::string convertPyObjectToString(PyObject* ob);
+    bool checkPyObject(const TypeCode *t,PyObject* ob);
+
+    PyObject *convertXmlPyObject(const TypeCode * t,xmlDocPtr doc,xmlNodePtr cur );
+    PyObject *convertXmlStrPyObject(const TypeCode * t,std::string data );
+    CORBA::Any *convertXmlCorba(const TypeCode * t,xmlDocPtr doc,xmlNodePtr cur );
+    YACS::ENGINE::Any *convertXmlNeutral(const TypeCode * t,xmlDocPtr doc,xmlNodePtr cur );
+
+    PyObject *convertNeutralPyObject(const TypeCode * t,YACS::ENGINE::Any* ob);
+    std::string convertNeutralXml(const TypeCode * t,YACS::ENGINE::Any* ob);
+    CORBA::Any *convertNeutralCorba(const TypeCode *t,YACS::ENGINE::Any *ob);
+    YACS::ENGINE::Any *convertNeutralNeutral(const TypeCode *t, YACS::ENGINE::Any* ob);
   }
 
 }