Salome HOME
Bug correction EDF12462 (3/3)
[modules/yacs.git] / src / engine / Runtime.hxx
index 2e8b65f0f9ff45096ba8d425f02639e31b54b36c..044efacc97d38f165d547b38cdfa9adc1e59c79c 100644 (file)
@@ -1,29 +1,54 @@
+// Copyright (C) 2006-2015  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); // singleton creation
+    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;
     class InlineFuncNode;
     class ServiceNode;
+    class DataNode;
     class Container;
     class ServiceInlineNode;
     class ComponentInstance;
@@ -32,22 +57,29 @@ 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 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);
 
       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 DataNode* createInDataNode(const std::string& kind,const std::string& name);
+      virtual DataNode* createOutDataNode(const std::string& kind,const std::string& name);
 
       virtual ComponentInstance* createComponentInstance(const std::string& name,
                                                          const std::string& kind="");
@@ -57,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,
@@ -77,8 +116,18 @@ 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();
     public:
       static const char RUNTIME_ENGINE_INTERACTION_IMPL_NAME[];
@@ -87,12 +136,22 @@ 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();
+      virtual void addCatalog(Catalog* catalog);
+      virtual TypeCode* getTypeCode(const std::string& name);
+
     protected:
       static Runtime* _singleton;
-      Runtime() { }
+      Runtime();
       std::set<std::string> _setOfImplementation;
-
+      Catalog* _builtinCatalog;
+      std::vector<Catalog*> _catalogs;
     };
+
   }
 }
 #endif