]> SALOME platform Git repositories - modules/yacs.git/blobdiff - src/engine/Container.hxx
Salome HOME
[EDF27816] Management of double foreach and management of proxyfile lifecycle
[modules/yacs.git] / src / engine / Container.hxx
index 89fbb5334304dc37e5a470bc039245c7f7ad99ac..98a40fa7664b0053cb7010487cc45cfa3c9442f2 100644 (file)
@@ -1,24 +1,26 @@
-//  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2023  CEA, EDF
 //
-//  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.
+// 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #ifndef __CONTAINER_HXX__
 #define __CONTAINER_HXX__
 
+#include "YACSlibEngineExport.hxx"
 #include "Exception.hxx"
 #include "RefCounter.hxx"
 
@@ -30,10 +32,13 @@ namespace YACS
   namespace ENGINE
   {
     class ComponentInstance;
+    class Proc;
+    class Task;
     /*!
      * This is an abstract class, that represents an abstract process in which ComponentInstances can be launched and run.
+     * An instance of this will be mapped to one and only one physical container (except in the foreach context)
      */
-    class Container : public RefCounter
+    class YACSLIBENGINE_EXPORT Container : public RefCounter
     {
     protected:
       Container();
@@ -41,29 +46,51 @@ namespace YACS
       virtual ~Container();
 #endif
     public:
+      virtual std::string getKind() const = 0;
       //Execution only methods
-      virtual bool isAlreadyStarted() const = 0;
-      virtual void start() throw(Exception) = 0;
-      virtual std::string getPlacementId() const = 0;
+      virtual std::string getDiscreminantStrOfThis(const Task *askingNode) const;
+      virtual bool isAlreadyStarted(const Task *askingNode) const = 0;
+      virtual void start(const Task *askingNode)  = 0;
+      virtual void start(const Task *askingNode,
+                         const std::string& resource_name,
+                         const std::string& container_name);
+      virtual bool canAcceptImposedResource();
+      virtual bool isUsingPythonCache();
+      virtual void usePythonCache(bool v);
+      virtual std::string getPlacementId(const Task *askingNode) const = 0;
+      virtual std::string getFullPlacementId(const Task *askingNode) const = 0;
       //Edition only methods
+      virtual void setAttachOnCloningStatus(bool val) const;
       virtual void attachOnCloning() const;
       virtual void dettachOnCloning() const;
-      bool isAttachedOnCloning() const;
+      virtual bool isAttachedOnCloning() const;
+      virtual void lock() = 0;
+      virtual void unLock() = 0;
       //! \b WARNING ! clone behaviour \b MUST be in coherence with what is returned by isAttachedOnCloning() method
       virtual Container *clone() const = 0;
+      virtual Container *cloneAlways() const = 0;
       virtual bool isSupportingRTODefNbOfComp() const;
-      virtual void checkCapabilityToDealWith(const ComponentInstance *inst) const throw(Exception) = 0;
-      virtual void setProperty(const std::string& name,const std::string& value);
-      virtual std::string getProperty(const std::string& name);
-      std::map<std::string,std::string> getProperties() { return _propertyMap; };
-      virtual void setProperties(std::map<std::string,std::string> properties);
-      std::string getName() const { return _name; };
+      virtual void checkCapabilityToDealWith(const ComponentInstance *inst) const  = 0;
+      virtual void setProperty(const std::string& name,const std::string& value) = 0;
+      virtual std::string getProperty(const std::string& name) const = 0;
+      virtual void clearProperties() = 0;
+      virtual void addComponentName(const std::string& name) = 0;
+      virtual std::map<std::string,std::string> getProperties() const = 0;
+      virtual std::map<std::string,std::string> getResourceProperties(const std::string& name) const = 0;
+      virtual void setProperties(const std::map<std::string,std::string>& properties);
+      virtual std::string getName() const { return _name; }
       //! \b WARNING ! name is used in edition to identify different containers, it is not the runtime name of the container
-      void setName(std::string name) { _name = name; };
+      void setName(std::string name) { _name = name; }
+      void setProc(Proc* proc) { _proc = proc; }
+      Proc* getProc() { return _proc; }
+      virtual void shutdown(int level) = 0;
+      static const char KIND_ENTRY[];
+      static const char AOC_ENTRY[];
+      static const char USE_PYCACHE_PROPERTY[];
     protected:
       std::string _name;
       mutable bool _isAttachedOnCloning;
-      std::map<std::string,std::string> _propertyMap;
+      Proc* _proc;
     };
   }
 }