35 mutable std::map<Node *,std::set<Node *> > *
_fwLinks;
37 mutable std::map<Node *,std::set<Node *> > *
_bwLinks;
42 Bloc(
const std::string& name);
45 int getNumberOfCFLinks()
const;
46 void init(
bool start=
true);
47 void getReadyTasks(std::vector<Task *>& tasks);
54 std::vector< std::list<Node *> > splitIntoIndependantGraph()
const;
55 Node *getChildByShortName(
const std::string& name)
const throw(
Exception);
56 virtual void writeDot(std::ostream &os)
const;
58 template<
bool direction>
59 void findAllPathsStartingFrom(
Node *start, std::list< std::vector<Node *> >& vec, std::map<
Node *, std::set<Node *> >& accelStr)
const;
60 template<
bool direction>
61 void findAllNodesStartingFrom(
Node *start, std::set<Node *>& result, std::map<
Node *, std::set<Node *> >& accelStr,
LinkInfo& info)
const;
62 virtual std::string
typeName() {
return "YACS__ENGINE__Bloc"; }
63 int getMaxLevelOfParallelism()
const;
64 void removeRecursivelyRedundantCL();
66 bool areAllSubNodesFinished()
const;
67 bool areAllSubNodesDone()
const;
68 bool isNameAlreadyUsed(
const std::string& name)
const;
70 std::vector< std::pair<OutGate *, InGate *> > getSetOfInternalCFLinks()
const;
73 void initComputation()
const;
74 void performCFComputationsOnlyOneLevel(
LinkInfo& info)
const;
75 void performCFComputations(
LinkInfo& info)
const;
76 void destructCFComputations(
LinkInfo& info)
const;
77 void checkControlDependancy(
OutPort *start,
InPort *end,
bool cross,
78 std::map <
ComposedNode *, std::list < OutPort * >, SortHierarc >& fw,
79 std::vector<OutPort *>& fwCross,
80 std::map<
ComposedNode *, std::list < OutPort *>, SortHierarc >& bw,
82 bool areLinked(
Node *start,
Node *end,
bool fw)
const;
83 bool arePossiblyRunnableAtSameTime(
Node *start,
Node *end)
const;
84 void checkCFLinks(
const std::list<OutPort *>& starts,
InputPort *end,
unsigned char& alreadyFed,
bool direction,
LinkInfo& info)
const;
85 static void verdictForOkAndUseless1(
const std::map<
Node *,std::list <OutPort *> >& pool,
InputPort *end,
const std::vector<Node *>& candidates,
86 unsigned char& alreadyFed,
bool direction,
LinkInfo& info);
87 static void verdictForCollapses(
const std::map<
Node *,std::list <OutPort *> >& pool,
InputPort *end,
const std::set<Node *>& candidates,
88 unsigned char& alreadyFed,
bool direction,
LinkInfo& info);
89 void seekOkAndUseless1(std::vector<Node *>& okAndUseless1, std::set<Node *>& allNodes)
const;
90 void seekUseless2(std::vector<Node *>& useless2, std::set<Node *>& allNodes)
const;
92 static void findUselessLinksIn(
const std::list< std::vector<Node *> >& res ,
LinkInfo& info);
93 template<
bool direction>
94 static unsigned appendIfAlreadyFound(std::list< std::vector<Node *> >& res,
const std::vector<Node *>& startRes,
Node *node, std::map<
Node *, std::set<Node *> >& fastFinder);
95 static void updateWithNewFind(
const std::vector<Node *>& path, std::map<
Node *, std::set<Node *> >& fastFinder);
98 template<
bool direction>
106 typedef std::list< std::pair<InGate *,bool> >::iterator
Iterator;
107 typedef std::list< std::pair<InGate *,bool> >&
Nexts;
115 typedef std::list< std::pair<OutGate *,bool> >::iterator
Iterator;
116 typedef std::list< std::pair<OutGate *,bool> >&
Nexts;
124 template<
bool direction>
127 std::map<Node *, std::set<Node *> >::iterator iter=fastFinder.find(node);
128 if(iter==fastFinder.end())
131 std::vector<std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator > > li;
132 std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator> ipr(((*iter).second).begin(),((*iter).second).end());
134 std::vector<Node *> work(startRes);
135 std::list< std::vector<Node *> >::iterator where=res.end(); where--;
136 std::list< std::vector<Node *> >::iterator updates=where;
139 if(li.back().first!=li.back().second)
141 work.push_back(*(li.back().first));
144 where=res.insert(where,work);
151 std::set<Node *>& s=fastFinder[*(li.back().first)];
152 std::pair<std::set<Node *>::iterator, std::set<Node *>::iterator> pr(s.begin(),s.end());
165 for(
unsigned i=0;
i<
ret;
i++,updates--)
170 template<
bool direction>
172 std::map<
Node *, std::set<Node *> >& accelStr,
LinkInfo& info)
const
174 std::list< std::vector<Node *> > li;
175 findAllPathsStartingFrom<direction>(start,li,accelStr);
176 for(std::list< std::vector<Node *> >::const_iterator iter=li.begin();iter!=li.end();iter++)
177 for(std::vector<Node *>::const_iterator iter2=(*iter).begin()+1;iter2!=(*iter).end();iter2++)
178 result.insert(*iter2);
190 template<
bool direction>
192 std::map<
Node *, std::set<Node *> >& accelStr)
const
198 vec.push_back(std::vector<Node *>());
200 std::list< std::vector<Node *> >::iterator curLine=vec.begin();
203 (*curLine).push_back(current);
209 vec.push_back(std::vector<Node *>((*curLine)));
216 current=(*curLine)[idInCase];
217 (*curLine).pop_back();
218 (*curLine).pop_back();
224 appendIfAlreadyFound<direction>(vec,(*curLine),current,accelStr);
225 curLine=vec.end(); curLine--;
230 current=(*curLine)[idInCase];
231 (*curLine).pop_back();
232 (*curLine).pop_back();
242 (*curLine).pop_back();
246 current=(*curLine)[idInCase];
247 (*curLine).pop_back();
253 current=(*iter).first->getNode();