Salome HOME
Merge branch 'omu/update_doc_77'
[modules/yacs.git] / src / engine / Node.cxx
index b0df78c5a039193981aae5fd4773a3343292fd1a..774e670e07f5ae76146b0f3763c355adfe3852d5 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2006-2012  CEA/DEN, EDF R&D
+// 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.
+// 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
@@ -88,6 +88,7 @@ Node::Node(const Node& other, ComposedNode *father):_inGate(this),_outGate(this)
 
 Node::~Node()
 {
+  delete _inPropertyPort;
 }
 
 /**
@@ -106,13 +107,49 @@ void Node::init(bool start)
   setState(YACS::READY);
 }
 
+/*!
+ * This method clones \a this by :
+ *
+ * - deep copying nodes, links, ports, types
+ * - containers are either deep copied or shallow copied depending on _isAttachedOnCloning attribute.
+ * - component are either deep copied or shallow copied depending on _isAttachedOnCloning attribute.
+ *
+ * So \b this \b method \b clone \b is \b dedicated \b for \b DynParaLoop \b class \b or \b subclasses.
+ * It \b should \b not \b be \b used \b elsewhere, because
+ * _isAttachedOnCloning attribute is an attribute in the engine not for GUI/TUI aspects.
+ * For GUI/TUI manipulation cloneWithoutCompAndContDeepCpy method should be used preferably.
+ *
+ * \param [in] father - The new father of the returned clone.
+ * \param [in] editionOnly ignored
+ *
+ * \sa cloneWithoutCompAndContDeepCpy
+ */
 Node *Node::clone(ComposedNode *father, bool editionOnly) const
 {
-  Node *ret=simpleClone(father,editionOnly);
+  Node *ret(simpleClone(father,editionOnly));
   ret->performDuplicationOfPlacement(*this);
   return ret;
 }
 
+/*!
+ * This method clones \a this by :
+ * - deep copying nodes, links, ports, types
+ * - shallow copy containers
+ * - shallow copy components
+ *
+ * So this method simply ignores isAttachedOnCloning attribute for both containers and components.
+ * So this method is dedicated for the GUI/TUI users.
+ *
+ * \param [in] father - The new father of the returned clone.
+ * \param [in] editionOnly ignored
+ */
+Node *Node::cloneWithoutCompAndContDeepCpy(ComposedNode *father, bool editionOnly) const
+{
+  Node *ret(simpleClone(father,editionOnly));
+  ret->performShallowDuplicationOfPlacement(*this);
+  return ret;
+}
+
 //! Change the name of the node
 /*!
  *  raise an exception if the name is already used in the scope of its father 
@@ -140,12 +177,12 @@ void Node::setName(const std::string& name)
  *  get the set of all nodes connected to the outGate
  */
 
-set<Node *> Node::getOutNodes() const
+list<Node *> Node::getOutNodes() const
 {
-  set<Node *> ret;
-  set<InGate *> inGates=_outGate.edSetInGate();
-  for(set<InGate *>::iterator iter=inGates.begin();iter!=inGates.end();iter++)
-    ret.insert((*iter)->getNode());
+  list<Node *> ret;
+  list<InGate *> inGates=_outGate.edSetInGate();
+  for(list<InGate *>::iterator iter=inGates.begin();iter!=inGates.end();iter++)
+    ret.push_back((*iter)->getNode());
   return ret;
 }
 
@@ -734,7 +771,7 @@ void Node::cleanNodes()
 void Node::resetState(int level)
 {
   DEBTRACE("Node::resetState " << getName() << "," << level << "," << _state);
-  if(_state==YACS::ERROR || _state==YACS::FAILED)
+  if(_state==YACS::ERROR || _state==YACS::FAILED || _state==YACS::ACTIVATED)
     {
       setState(YACS::READY);
       InGate* inGate = getInGate();