Salome HOME
Merge remote-tracking branch 'origin/master' into V9_dev
[modules/yacs.git] / src / engine / ElementaryNode.cxx
index 0b5a1769656a807ba7040aa9106a6ee56d0da0eb..129deaa1d701bbbc0466d8e007ea257854cb7697 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2006-2013  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
 // 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
@@ -69,6 +69,10 @@ void ElementaryNode::performDuplicationOfPlacement(const Node& other)
 {
 }
 
+void ElementaryNode::performShallowDuplicationOfPlacement(const Node& other)
+{
+}
+
 ElementaryNode::~ElementaryNode()
 {
   for(list<InputPort *>::iterator iter1=_setOfInputPort.begin();iter1!=_setOfInputPort.end();iter1++)
@@ -81,24 +85,25 @@ ElementaryNode::~ElementaryNode()
     delete *iter4;
 }
 
-void ElementaryNode::init(bool start)
+void ElementaryNode::initCommonPartWithoutStateManagement(bool start)
 {
-  DEBTRACE("ElementaryNode::init " << getName() << " " << start << " " << _state);
-
   for(list<OutputPort *>::iterator iter=_setOfOutputPort.begin();iter!=_setOfOutputPort.end();iter++)
     (*iter)->exInit();
   for(list<InputPort *>::iterator iter2=_setOfInputPort.begin();iter2!=_setOfInputPort.end();iter2++)
     (*iter2)->exInit(start);
   _inGate.exReset();
+}
+
+void ElementaryNode::init(bool start)
+{
+  DEBTRACE("ElementaryNode::init " << getName() << " " << start << " " << _state);
+  initCommonPartWithoutStateManagement(start);
   if(_state == YACS::DISABLED)
     {
       exDisabledState(); // to refresh propagation of DISABLED state
-      return;
+      return ;
     }
-  if(start) //complete initialization
-    setState(YACS::READY);
-  else if(_state > YACS::LOADED)//partial initialization (inside a loop)
-    setState(YACS::TORECONNECT);
+  setState(YACS::READY);
 }
 
 bool ElementaryNode::isDeployable() const
@@ -111,6 +116,11 @@ ComponentInstance *ElementaryNode::getComponent()
   return 0;
 }
 
+const ComponentInstance *ElementaryNode::getComponent() const
+{
+  return 0;
+}
+
 Container *ElementaryNode::getContainer()
 {
   return 0;
@@ -538,6 +548,24 @@ list<ElementaryNode *> ElementaryNode::getRecursiveConstituents() const
   return ret;
 }
 
+//! Get the progress weight for all elementary nodes
+/*!
+ * Only elementary nodes have weight. At this stage weight is 0 or 1 (it can be modified later following
+ * the kind of father)
+ */
+list<ProgressWeight> ElementaryNode::getProgressWeight() const
+{
+  list<ProgressWeight> ret;
+  ProgressWeight myWeight;
+  myWeight.weightTotal=1;
+  if (getState() == YACS::DONE)
+    myWeight.weightDone=1;
+  else
+    myWeight.weightDone=0;
+  ret.push_back(myWeight);
+  return ret;
+}
+
 Node *ElementaryNode::getChildByName(const std::string& name) const throw(YACS::Exception)
 {
   string what("ElementaryNode does not agregate any nodes particullary node with name "); what+=name;