]> SALOME platform Git repositories - modules/yacs.git/blobdiff - src/engine/Bloc.hxx
Salome HOME
Fix memory corruption and refactor some points.
[modules/yacs.git] / src / engine / Bloc.hxx
index 9373de05a7ded521175351956b8e0c8f4706183a..98f2e0fc0b6f9d6920fe16c4b105216d452a9c12 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2006-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2014  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
@@ -52,7 +52,6 @@ namespace YACS
       std::list<Node *> getChildren() const { return _setOfNode; }
       std::list<Node *> edGetDirectDescendants() const { return _setOfNode; }
       Node *getChildByShortName(const std::string& name) const throw(Exception);
-      void selectRunnableTasks(std::vector<Task *>& tasks);
       virtual void writeDot(std::ostream &os) const;
       void accept(Visitor *visitor);
       template<bool direction>
@@ -121,12 +120,13 @@ namespace YACS
     template<bool direction>
     unsigned Bloc::appendIfAlreadyFound(std::list< std::vector<Node *> >& res, const std::vector<Node *>& startRes, Node *node, std::map<Node *, std::set<Node *> >& fastFinder)
     {
-      std::map<Node *, std::set<Node *> >::const_iterator iter=fastFinder.find(node);
+      std::map<Node *, std::set<Node *> >::iterator iter=fastFinder.find(node);
       if(iter==fastFinder.end())
         return 0;
       unsigned ret=0;
       std::vector<std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator > > li;
-      li.push_back(std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator>(((*iter).second).begin(),((*iter).second).end()));
+      std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator> ipr(((*iter).second).begin(),((*iter).second).end());
+      li.push_back(ipr);
       std::vector<Node *> work(startRes);
       std::list< std::vector<Node *> >::iterator where=res.end(); where--;
       std::list< std::vector<Node *> >::iterator updates=where;
@@ -144,8 +144,9 @@ namespace YACS
                 }
               else
                 {
-                  const std::set<Node *>& s=fastFinder[*(li.back().first)];
-                  li.push_back(std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator>(s.begin(),s.end()));
+                  std::set<Node *>& s=fastFinder[*(li.back().first)];
+                  std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator> pr(s.begin(),s.end());
+                  li.push_back(pr);
                 }
             }
           else