Salome HOME
Use /tmp for temporary files needed by salome tests.
[modules/yacs.git] / src / runtime / RuntimeSALOME.hxx
index 04c0c31e7f3aad76b1f02679b519ab33c834765f..8d2172979efe8ff04768795c23dad580037cda27 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2006-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2019  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.
+// 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
@@ -19,6 +19,7 @@
 
 #ifndef _RUNTIMESALOME_HXX_
 #define _RUNTIMESALOME_HXX_
+#include <Python.h>
 
 #include "YACSRuntimeSALOMEExport.hxx"
 
 #undef _XOPEN_SOURCE
 #endif
 
-#include <Python.h>
 #include <omniORB4/CORBA.h>
+#include <omniORBpy.h>
 #include "Runtime.hxx"
 
 #include<string>
 #include<set>
-
-//--- from omniORBpy.h (not present on Debian Sarge packages)
-struct omniORBpyAPI
-{
-      PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-                                       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);
-      // 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.
-
-      PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex);
-      // Sets the Python exception state to reflect the given C++ system
-      // exception. Always returns NULL. The caller must hold the Python
-      // interpreter lock.
-};
-//--- end of from omniORBpy.h (not present on Debian Sarge packages)
       
 namespace YACS
 {
@@ -74,6 +54,8 @@ namespace YACS
 
     class YACSRUNTIMESALOME_EXPORT RuntimeSALOME: public Runtime
     {
+      static Runtime* getSingleton() { return Runtime::_singleton; }
+
     public:
       
       enum 
@@ -86,15 +68,17 @@ namespace YACS
         UseSalome = 32
       } FLAGS;
 
-      static void setRuntime(long flags = UsePython+UseCorba+UseXml+UseCpp+UseSalome); // singleton creation
+      // singleton creation
+      static void setRuntime(long flags = UsePython+UseCorba+UseXml+UseCpp+UseSalome,
+                             int argc = 0, char* argv[] = NULL);
       
       friend RuntimeSALOME* getSALOMERuntime();
       
       virtual std::string getVersion() const;
 
-      virtual void init(long flags);
+      virtual void init(long flags, int argc, char* argv[]);
       virtual void fini();
-
+      virtual std::vector< std::pair<std::string,int> > getCatalogOfComputeNodes() const;
       virtual InputPort* createInputPort(const std::string& name,
                                          const std::string& impl,
                                          Node * node,
@@ -120,7 +104,9 @@ namespace YACS
       virtual ServiceInlineNode *createSInlineNode(const std::string& kind, const std::string& name);
       virtual ComponentInstance* createComponentInstance(const std::string& name,
                                                          const std::string& kind="");
+#ifndef SWIG
       virtual Container *createContainer(const std::string& kind="");
+#endif
       virtual WhileLoop* createWhileLoop(const std::string& name);
       virtual ForLoop* createForLoop(const std::string& name);
       virtual OptimizerLoop* createOptimizerLoop(const std::string& name,const std::string& algLib,
@@ -241,16 +227,16 @@ namespace YACS
 
       virtual ~RuntimeSALOME(); 
 
-      CORBA::ORB_ptr getOrb();
-      PyObject * getPyOrb();
-      PyObject * getBuiltins();
-      DynamicAny::DynAnyFactory_ptr getDynFactory();
+      CORBA::ORB_ptr getOrb() const;
+      PyObject * getPyOrb() const;
+      PyObject * getBuiltins() const;
+      DynamicAny::DynAnyFactory_ptr getDynFactory() const;
       omniORBpyAPI* getApi();
       PyObject * get_omnipy();
 
     protected:
       RuntimeSALOME();  // singleton
-      RuntimeSALOME(long flags);  // singleton
+      RuntimeSALOME(long flags, int argc, char* argv[]);  // singleton
       void initBuiltins();
       CORBA::ORB_var _orb;
       PyObject * _pyorb;