Salome HOME
Merge Python 3 porting.
[modules/yacs.git] / src / engine / Node.hxx
index caff230d9e2570020ce16e4610754f7497ff9a06..f379204821a7677a3385eca4e2ad5619a28bc625 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2016  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
@@ -21,6 +21,8 @@
 #define __NODE_HXX__
 
 #include "YACSlibEngineExport.hxx"
+#include "PlayGround.hxx"
+#include "AutoRefCnt.hxx"
 #include "InGate.hxx"
 #include "OutGate.hxx"
 #include "Exception.hxx"
@@ -42,8 +44,8 @@ namespace YACS
     class InputPort;
     class OutputPort;
     class InPropertyPort;
-    class DynParaLoop;
     class ForEachLoop;
+    class DynParaLoop;
     class ComposedNode;
     class Proc;
     class ElementaryNode;
@@ -52,6 +54,12 @@ namespace YACS
     class OutputDataStreamPort;
     class Visitor;
 
+    struct ProgressWeight
+    {
+       int weightDone;
+       int weightTotal;
+    };
+
     class YACSLIBENGINE_EXPORT NodeStateNameMap : public std::map<YACS::StatesForNode, std::string>
     {
     public:
@@ -91,7 +99,10 @@ namespace YACS
     protected:
       Node(const std::string& name);
       Node(const Node& other, ComposedNode *father);
+      //! performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute.
       virtual void performDuplicationOfPlacement(const Node& other) = 0;
+      //! performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning.
+      virtual void performShallowDuplicationOfPlacement(const Node& other) = 0;
       virtual Node *simpleClone(ComposedNode *father, bool editionOnly=true) const = 0;
     public:
       virtual ~Node();
@@ -100,6 +111,8 @@ namespace YACS
       virtual void resetState(int level);
       //! \b This method \b MUST \b NEVER \b BE \b VIRTUAL
       Node *clone(ComposedNode *father, bool editionOnly=true) const;
+      //! \b This method \b MUST \b NEVER \b BE \b VIRTUAL
+      Node *cloneWithoutCompAndContDeepCpy(ComposedNode *father, bool editionOnly=true) const;
       void setState(YACS::StatesForNode theState); // To centralize state changes
       virtual YACS::StatesForNode getState() const { return _state; }
       virtual YACS::StatesForNode getEffectiveState() const;
@@ -113,13 +126,14 @@ namespace YACS
       ComposedNode * getFather() const { return _father; }
       const std::string getId() const;
       bool exIsControlReady() const;
-      std::set<Node *> getOutNodes() const;
+      std::list<Node *> getOutNodes() const;
       virtual void writeDot(std::ostream &os) const;
       virtual void exUpdateState();
       virtual void exFailedState();
       virtual void exDisabledState();
       virtual void getReadyTasks(std::vector<Task *>& tasks) = 0;
       virtual std::list<ElementaryNode *> getRecursiveConstituents() const = 0;
+      virtual std::list<ProgressWeight> getProgressWeight() const = 0;
       virtual int getNumberOfInputPorts() const = 0;
       virtual int getNumberOfOutputPorts() const = 0;
       std::list<InPort *> getSetOfInPort() const;
@@ -149,31 +163,38 @@ namespace YACS
       bool operator>(const Node& other) const;
       bool operator<(const Node& other) const;
       std::string getImplementation() const;
+      DynParaLoop *getClosestDPLAmongAncestors() const;
       virtual ComposedNode *getRootNode() const throw(Exception);
       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() ;
-      std::map<std::string,std::string> getPropertyMap(){return _propertyMap;} ;
+      std::map<std::string,std::string> getPropertyMap() { return _propertyMap; }
       virtual void setProperties(std::map<std::string,std::string> properties);
       virtual Node *getChildByName(const std::string& name) const throw(Exception) = 0;
       virtual Proc *getProc();
       virtual const Proc *getProc() const;
       virtual void accept(Visitor *visitor) = 0;
+      virtual int getMaxLevelOfParallelism() const = 0;
+      virtual double getWeightRegardingDPL() const = 0;
+      virtual void partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNode *, YACS::BASES::AutoRefCnt<PartDefinition> >& zeMap) = 0;
       std::string getQualifiedName() const;
       int getNumId();
+      std::vector<std::pair<std::string,int> > getDPLScopeInfo(ComposedNode *gfn);
+      virtual void applyDPLScope(ComposedNode *gfn);
       virtual void sendEvent(const std::string& event);
+      virtual void sendEvent2(const std::string& event, void *something);
       static std::map<int,Node *> idMap;
-      virtual std::string typeName() {return "YACS__ENGINE__Node";}
-      virtual std::string getErrorDetails(){return _errorDetails;};
-      virtual void setErrorDetails(const std::string& error){_errorDetails=error;};
+      virtual std::string typeName() { return "YACS__ENGINE__Node"; }
+      virtual std::string getErrorDetails() const { return _errorDetails; }
+      virtual void setErrorDetails(const std::string& error) { _errorDetails=error; }
       virtual void modified();
-      virtual int isModified(){return _modified;}
+      virtual int isModified() { return _modified; }
       virtual int isValid();
       virtual void edUpdateState();
       virtual std::string getErrorReport();
       virtual std::string getContainerLog();
       virtual void ensureLoading();
-      virtual void getCoupledNodes(std::set<Task*>& coupledNodes){};
+      virtual void getCoupledNodes(std::set<Task*>& coupledNodes) { }
       virtual void cleanNodes();
     protected:
       virtual void exForwardFailed();