Salome HOME
WIP
[modules/yacs.git] / src / engine / Runtime.hxx
index 1453f5c43c813718bd56e9ff734404a93cea0cbf..2792af7056313cb9168d4c7af5ab6283ff352002 100644 (file)
@@ -1,24 +1,48 @@
+// 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, 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 _RUNTIME_HXX_
 #define _RUNTIME_HXX_
 
+#include "YACSlibEngineExport.hxx"
 #include "ConversionException.hxx"
 
 #include<string>
 #include<set>
 #include<map>
 #include<vector>
+#include<list>
 
 namespace YACS
 {
   namespace ENGINE
   {
     class Runtime;
-    Runtime* getRuntime() throw(Exception);
+    YACSLIBENGINE_EXPORT Runtime* getRuntime() throw(Exception);
 
+    class Any;
     class InputPort;
     class OutputPort;
+    class InPropertyPort;
     class ForLoop;
     class ForEachLoop;
+    class OptimizerLoop;
     class WhileLoop;
     class Switch;
     class InlineNode;
@@ -33,18 +57,20 @@ namespace YACS
     class ElementaryNode;
     class Node;
     class TypeCode;
+    class TypeCodeStruct;
+    class TypeCodeObjref;
     class InputDataStreamPort;
     class OutputDataStreamPort;
     class Catalog;
     class CatalogLoader;
 
-    class Runtime
+    class YACSLIBENGINE_EXPORT Runtime
     {
       friend Runtime* getRuntime() throw(Exception);
     public:
       virtual void init() { }
       virtual void fini() { }
-
+      virtual std::vector< std::pair<std::string,int> > getCatalogOfComputeNodes() const = 0;
       virtual Catalog* loadCatalog(const std::string& sourceKind,const std::string& path);
       virtual InlineFuncNode* createFuncNode(const std::string& kind,const std::string& name);
       virtual InlineNode* createScriptNode(const std::string& kind,const std::string& name);
@@ -63,8 +89,15 @@ namespace YACS
       virtual WhileLoop* createWhileLoop(const std::string& name);
       virtual ForLoop* createForLoop(const std::string& name);
       virtual ForEachLoop* createForEachLoop(const std::string& name,TypeCode * type);
+      virtual OptimizerLoop* createOptimizerLoop(const std::string& name,const std::string& algLib,
+                                                 const std::string& factoryName,bool algInitOnFile,
+                                                 const std::string& kind="", Proc * procForTypes = NULL);
       virtual Switch* createSwitch(const std::string& name);
 
+      virtual TypeCode * createInterfaceTc(const std::string& id, const std::string& name,
+                                            std::list<TypeCodeObjref *> ltc);
+      virtual TypeCode * createSequenceTc(const std::string& id, const std::string& name, TypeCode *content);
+      virtual TypeCodeStruct * createStructTc(const std::string& id, const std::string& name);
       
       virtual InputPort* createInputPort(const std::string& name,
                                          const std::string& impl,
@@ -83,7 +116,16 @@ namespace YACS
                                                                Node * node,
                                                                TypeCode * type);
 
-      virtual InputPort* adapt(InputPort* source, const std::string& impl, TypeCode * type) throw (ConversionException) = 0;
+      virtual InputPort* adapt(InputPort* source, const std::string& impl, TypeCode * type,
+                               bool init=false) throw (ConversionException) = 0;
+
+      virtual InputPort* adapt(InPropertyPort* source,
+                               const std::string& impl,
+                               TypeCode * type,
+                               bool init=false) throw (ConversionException) = 0;
+
+      virtual void* convertNeutral(TypeCode * type, Any *data);
+      virtual std::string convertNeutralAsString(TypeCode * type, Any *data);
 
       virtual void removeRuntime();
       virtual ~Runtime();
@@ -94,6 +136,8 @@ namespace YACS
       static  YACS::ENGINE::TypeCode *_tc_bool;
       static  YACS::ENGINE::TypeCode *_tc_string;
       static  YACS::ENGINE::TypeCode *_tc_file;
+      static  YACS::ENGINE::TypeCode *_tc_stringpair;
+      static  YACS::ENGINE::TypeCode *_tc_propvec;
       virtual void setCatalogLoaderFactory(const std::string& name, CatalogLoader* factory);
       std::map<std::string,CatalogLoader*> _catalogLoaderFactoryMap;
       Catalog* getBuiltinCatalog();