Salome HOME
copy tag mergefrom_BR_V0_1_CC_Salome_04oct07
[modules/yacs.git] / src / runtime / RuntimeSALOME.hxx
index c92e087062b172462318e9abcdbad6d9c191df90..b64312d3525ae64576ea8dc4483396089b7371f2 100644 (file)
@@ -2,11 +2,9 @@
 #ifndef _RUNTIMESALOME_HXX_
 #define _RUNTIMESALOME_HXX_
 
+#include <Python.h>
+#include <omniORB4/CORBA.h>
 #include "Runtime.hxx"
-#include "CORBAPorts.hxx"
-#include "PythonPorts.hxx"
-#include "XMLPorts.hxx"
-#include "CORBAXMLConv.hxx"
 
 #include<string>
 #include<set>
@@ -22,12 +20,12 @@ namespace YACS
     {
       
       PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-                                      CORBA::Boolean hold_lock);
+                                       CORBA::Boolean hold_lock);
       // Convert a C++ object reference to a Python object reference.
       // If <hold_lock> is true, caller holds the Python interpreter lock.
       
       CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-                                              CORBA::Boolean hold_lock);
+                                               CORBA::Boolean hold_lock);
       // Convert a Python object reference to a C++ object reference.
       // Raises BAD_PARAM if the Python object is not an object reference.
       // If <hold_lock> is true, caller holds the Python interpreter lock.
@@ -36,73 +34,159 @@ namespace YACS
       omniORBpyAPI();
       // Constructor for the singleton. Sets up the function pointers.
     };
+
     class RuntimeSALOME;
     RuntimeSALOME* getSALOMERuntime();
 
+    class InputCorbaPort;
+    class InputPyPort;
+    class InputXmlPort;
+    class InputCppPort;
+
+
     class RuntimeSALOME: public Runtime
     {
     public:
       
-      static void setRuntime(); // singleton creation
+      static enum 
+      {
+             IsPyExt = 1,
+        UsePython = 2,
+             UseCorba = 4,
+             UseXml = 8,
+             UseCpp = 16,
+             UseSalome = 32
+      } FLAGS;
+
+      static void setRuntime(long flags = UsePython+UseCorba+UseXml+UseCpp+UseSalome); // singleton creation
       
       friend RuntimeSALOME* getSALOMERuntime();
 
-      virtual void init();
+      virtual void init(long flags);
       virtual void fini();
 
       virtual InputPort* createInputPort(const std::string& name,
-                                        const std::string& impl,
-                                        Node * node,
-                                        TypeCode * type);
+                                         const std::string& impl,
+                                         Node * node,
+                                         TypeCode * type);
 
       virtual OutputPort* createOutputPort(const std::string& name,
-                                          const std::string& impl,
-                                          Node * node,
-                                          TypeCode * type);
-
-      virtual ElementaryNode* createNode(std::string implementation,
-                                        std::string name ) throw(Exception);
-
-      virtual InputPort* adapt(const std::string& imp_source,
-                              InputPort* source,
-                              const std::string& impl,
-                              TypeCode * type) throw (ConversionException);
+                                           const std::string& impl,
+                                           Node * node,
+                                           TypeCode * type);
+      virtual InputDataStreamPort* createInputDataStreamPort(const std::string& name,
+                                                             Node *node,TypeCode *type);
+
+      virtual OutputDataStreamPort* createOutputDataStreamPort(const std::string& name,
+                                                               Node *node,TypeCode *type);
+
+      virtual InlineFuncNode* createFuncNode(const std::string& kind,const std::string& name);
+      virtual InlineNode* createScriptNode(const std::string& kind,const std::string& name);
+
+      virtual ServiceNode* createRefNode(const std::string& kind,const std::string& name);
+      virtual ServiceNode* createCompoNode(const std::string& kind,const std::string& name);
+      virtual ServiceInlineNode *createSInlineNode(const std::string& kind, const std::string& name);
+      virtual ComponentInstance* createComponentInstance(const std::string& name,
+                                                         const std::string& kind="");
+      virtual Container *createContainer(const std::string& kind="");
+      virtual WhileLoop* createWhileLoop(const std::string& name);
+      virtual ForLoop* createForLoop(const std::string& name);
+      virtual Bloc* createBloc(const std::string& name);
+      virtual Proc* createProc(const std::string& name);
+
+      virtual InputPort* adapt(InputPort* source,
+                               const std::string& impl,
+                               TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptNeutral(InputPort* source,
+                                      const std::string& impl,
+                                      TypeCode * type) throw (ConversionException);
 
       virtual InputPort* adapt(InputCorbaPort* source,
-                              const std::string& impl,
-                              TypeCode * type) throw (ConversionException);
+                               const std::string& impl,
+                               TypeCode * type) throw (ConversionException);
 
       virtual InputPort* adaptCorbaToCorba(InputCorbaPort* source,
-                                          TypeCode * type) throw (ConversionException);
+                                           TypeCode * type) throw (ConversionException);
+  
+      virtual InputPort* adaptCorbaToNeutral(InputCorbaPort* source,
+                                             TypeCode * type) throw (ConversionException);
 
       virtual InputPort* adaptCorbaToPython(InputCorbaPort* source,
-                                           TypeCode * type) throw (ConversionException);
+                                            TypeCode * type) throw (ConversionException);
 
       virtual InputPort* adaptCorbaToCpp(InputCorbaPort* source,
-                                        TypeCode * type) throw (ConversionException);
+                                         TypeCode * type) throw (ConversionException);
 
       virtual InputPort* adaptCorbaToXml(InputCorbaPort* source,
-                                        TypeCode * type) throw (ConversionException);
+                                         TypeCode * type) throw (ConversionException);
 
       virtual InputPort* adapt(InputPyPort* source,
-                              const std::string& impl,
-                              TypeCode * type) throw (ConversionException);
+                               const std::string& impl,
+                               TypeCode * type) throw (ConversionException);
 
       virtual InputPort* adaptPythonToCorba(InputPyPort* source,
-                                           TypeCode * type) throw (ConversionException);
+                                            TypeCode * type) throw (ConversionException);
       
+      virtual InputPort* adaptPythonToNeutral(InputPyPort* source,
+                                              TypeCode * type) throw (ConversionException);
+
       virtual InputPort* adaptPythonToPython(InputPyPort* source,
-                                            TypeCode * type) throw (ConversionException);
+                                             TypeCode * type) throw (ConversionException);
       
+      virtual InputPort* adaptPythonToXml(InputPyPort* source,
+                                          TypeCode * type) throw (ConversionException);
+
       virtual InputPort* adaptPythonToCpp(InputPyPort* source,
-                                         TypeCode * type) throw (ConversionException);
+                                          TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adapt(InputCppPort* source,
+                               const std::string& impl,
+                               TypeCode * type) throw (ConversionException);
+                               
+      virtual InputPort* adaptCppToCorba(InputCppPort* source,
+                                            TypeCode * type) throw (ConversionException);
+      
+      virtual InputPort* adaptCppToNeutral(InputCppPort* source,
+                                              TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptCppToPython(InputCppPort* source,
+                                             TypeCode * type) throw (ConversionException);
+      
+      virtual InputPort* adaptCppToXml(InputCppPort* source,
+                                          TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptCppToCpp(InputCppPort* source,
+                                          TypeCode * type) throw (ConversionException);
 
       virtual InputPort* adapt(InputXmlPort* source,
-                              const std::string& impl,
-                              TypeCode * type) throw (ConversionException);
+                               const std::string& impl,
+                               TypeCode * type) throw (ConversionException);
 
       virtual InputPort* adaptXmlToCorba(InputXmlPort* source,
-                                        TypeCode * type) throw (ConversionException);
+                                         TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptXmlToPython(InputXmlPort* inport,
+                                          TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptXmlToCpp(InputXmlPort* inport,
+                                          TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptXmlToNeutral(InputXmlPort* inport,
+                                          TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptNeutralToXml(InputPort* inport,
+                                           TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptNeutralToPython(InputPort* inport,
+                                              TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptNeutralToCorba(InputPort* inport,
+                                             TypeCode * type) throw (ConversionException);
+
+      virtual InputPort* adaptNeutralToCpp(InputPort* inport,
+                                             TypeCode * type) throw (ConversionException);
+      virtual ~RuntimeSALOME(); 
 
       CORBA::ORB_ptr getOrb();
       PyObject * getPyOrb();
@@ -112,11 +196,15 @@ namespace YACS
 
     protected:
       RuntimeSALOME();  // singleton
+      RuntimeSALOME(long flags);  // singleton
       CORBA::ORB_var _orb;
       PyObject * _pyorb;
       PyObject * _bltins;
       DynamicAny::DynAnyFactory_var _dynFactory;
       omniORBpyAPI* _api;
+      long _flags;
+      bool _usePython, _useCorba, _useCpp, _useXml;
+
     };
   }
 }