Version: 9.15.0
Loop.cxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #include "Loop.hxx"
21 #include "InputPort.hxx"
22 #include "OutputPort.hxx"
23 #include "InputDataStreamPort.hxx"
24 #include "OutputDataStreamPort.hxx"
25 #include "LinkInfo.hxx"
26 #include "Runtime.hxx"
27 #include "Visitor.hxx"
28 #include <cassert>
29 #include <iostream>
30 
31 //#define _DEVDEBUG_
32 #include "YacsTrace.hxx"
33 
34 using namespace YACS::ENGINE;
35 using namespace std;
36 
38  InputPort("", node, type),
39  DataPort("", node, type),
40  Port(node),_data(0)
41 {
42 }
43 
44 void InputPort4DF2DS::getAllRepresentants(std::set<InPort *>& repr) const
45 {
46  set<InPort *> s=_node->getOutputDataStreamPort("")->edSetInPort();
47  repr.insert(s.begin(),s.end());
48 }
49 
50 void *InputPort4DF2DS::get() const
51 {
52  if(!_data)
53  {
54  std::string what="InputPort4DF2DS::get : no value currently in input whith name \""; what+=_name; what+="\"";
55  throw Exception(what);
56  }
57  return (void *)_data;
58 }
59 
61 {
62  if(!_initValue)
63  return;
64  if(_data)
65  _data->decrRef();
67  _data->incrRef();
68 }
69 
71 {
72  if(_initValue)
76 }
77 
78 void InputPort4DF2DS::put(const void *data)
79 {
80  put((Any *)data);
81 }
82 
84 {
85  throw Exception("InputPort4DF2DS::clone : internal error");
86 }
87 
89 {
90  if(_data)
91  _data->decrRef();
92  _data = nullptr;
93 }
94 
96 {
98  _data=data;
99  _data->incrRef();
100 }
101 
103 {
104  if(_data)
105  _data->decrRef();
106 }
107 
108 DFToDSForLoop::DFToDSForLoop(Loop *loop, const std::string& name, TypeCode* type):ElementaryNode(""),_nbOfTimeUsed(1)
109 {
110  _name="DF2DS For "; _name+=loop->getName(); _name+=" representing port "; _name+=name;
111  _father=loop;
112  _setOfInputPort.push_back(new InputPort4DF2DS(this,type));
114 }
115 
117 {
119 }
120 
121 void DFToDSForLoop::getReadyTasks(std::vector<Task *>& tasks)
122 {
123 }
124 
125 InputPort *DFToDSForLoop::getInputPort(const std::string& name) const
126 {
127  try {
128  return Node::getInputPort(name);
129  }
130  catch(Exception& e) {}
131 
132  list<InputPort *>::const_iterator it =_setOfInputPort.begin();
133  return (*it);
134 }
135 
137 {
138  list<OutputDataStreamPort *>::const_iterator it =_setOfOutputDataStreamPort.begin();
139  return (*it);
140 }
141 
143 {
144 }
145 
147 {
148  //TO IMPLEMENT
149 }
150 
151 Node *DFToDSForLoop::simpleClone(ComposedNode *father, bool editionOnly) const
152 {
153  throw Exception("DFToDSForLoop::simpleClone : Internal error");
154 }
155 
157  OutputPort("", node, type),
158  DataPort("", node, type),
159  Port(node),_data(0)
160 {
161 }
162 
163 void OutputPort4DS2DF::getAllRepresented(std::set<OutPort *>& represented) const
164 {
165  set<OutPort *> setO=_node->getInputDataStreamPort("")->edSetOutPort();
166  for(set<OutPort *>::iterator iter=setO.begin();iter!=setO.end();iter++)
167  (*iter)->getAllRepresented(represented);
168 }
169 
170 void OutputPort4DS2DF::put(const void *data)
171 {
172  put((Any *)data);
173  OutputPort::put(data);
174 }
175 
177 {
178  throw Exception("OutputPort4DS2DF::clone : Internal error");
179 }
180 
182 {
183  if(_data)
184  _data->decrRef();
185  _data=data;
186  _data->incrRef();
187 }
188 
190 {
191  if(_data)
192  _data->decrRef();
193 }
194 
196  InputDataStreamPort("", node, type),
197  DataPort("", node, type),
198  Port(node)
199 {
200 }
201 
202 void InputDataStreamPort4DS2DF::getAllRepresentants(std::set<InPort *>& repr) const
203 {
204  set<InPort *> s=_node->getOutputPort("")->edSetInPort();
205  repr.insert(s.begin(),s.end());
206 }
207 
208 DSToDFForLoop::DSToDFForLoop(Loop *loop, const std::string& name, TypeCode* type):ElementaryNode(""),_nbOfTimeUsed(1)
209 {
210  _name="DS2DF For "; _name+=loop->getName(); _name+=" representing port "; _name+=name;
211  _father=loop;
212  _setOfOutputPort.push_back(new OutputPort4DS2DF(this,type));
213  _setOfInputDataStreamPort.push_back(new InputDataStreamPort4DS2DF(this,type));
214 }
215 
216 Node *DSToDFForLoop::simpleClone(ComposedNode *father, bool editionOnly) const
217 {
218  throw Exception("DSToDFForLoop::simpleClone : Internal error");
219 }
220 
222 {
224 }
225 
226 void DSToDFForLoop::getReadyTasks(std::vector<Task *>& tasks)
227 {
228 }
229 
230 OutputPort *DSToDFForLoop::getOutputPort(const std::string& name) const
231 {
232  list<OutputPort *>::const_iterator it = _setOfOutputPort.begin();
233  return (*it);
234 }
235 
237 {
238  list<InputDataStreamPort *>::const_iterator it = _setOfInputDataStreamPort.begin();
239  return (*it);
240 }
241 
243 {
244 }
245 
247 {
248  //TO IMPLEMENT
249 }
250 
251 FakeNodeForLoop::FakeNodeForLoop(Loop *loop, bool normalFinish, bool internalError):ElementaryNode("thisIsAFakeNode"),
252  _loop(loop),
253  _normalFinish(normalFinish),
254  _internalError(internalError)
255 {
258 }
259 
261  _normalFinish(false),_internalError(true)
262 {
263 }
264 
265 Node *FakeNodeForLoop::simpleClone(ComposedNode *father, bool editionOnly) const
266 {
267  return new FakeNodeForLoop(*this);
268 }
269 
271 {
273 }
274 
276 {
278 }
279 
281 {
282  if(!_normalFinish)
283  throw Exception("");//only to trigger ABORT on Executor
284 }
285 
287 {
288  if(_internalError)
290  else
292 }
293 
295 {
297 }
298 
299 Loop::Loop(const Loop& other, ComposedNode *father, bool editionOnly):StaticDefinedComposedNode(other,father),_nbOfTurns(0),_nodeForNullTurnOfLoops(0),_node(0)
300 {
301  if(other._node)
302  _node=other._node->simpleClone(this,editionOnly);
303 }
304 
305 Loop::Loop(const std::string& name):StaticDefinedComposedNode(name),_node(0),_nbOfTurns(0),_nodeForNullTurnOfLoops(0)
306 {
307 }
308 
310 {
311  delete _node;
313  for(set<DSToDFForLoop *>::iterator iter1=_inputsTraducer.begin();iter1!=_inputsTraducer.end();iter1++)
314  delete (*iter1);
315  for(set<DFToDSForLoop *>::iterator iter2=_outputsTraducer.begin();iter2!=_outputsTraducer.end();iter2++)
316  delete (*iter2);
317 }
318 
319 void Loop::init(bool start)
320 {
322  _nbOfTurns=0;
323  if(_node)
324  _node->init(start); // if start is true, refresh the internal node
325  else
326  throw Exception("Loop::initLoop : no nodes specifies to be repeated ");
329 }
330 
332 {
333  if(_node==node)
334  return 0;
335  if(node)
336  {
337  if(node->_father)
338  {
339  string what = "Loop::edSetNode: node "; what += node->getName(); what += " is not orphan ! ";
340  throw Exception(what);
341  }
342  }
345  Node *ret=_node;
346  _node=node;
347  _node->_father=this;
348  //set _modified flag so that edUpdateState() can refresh state
349  modified();
350  return ret;
351 }
352 
353 bool Loop::edAddChild(Node *node)
354 {
355  return edSetNode(node);
356 }
357 
359 {
361  Node *ret=_node;
362  _node=0;
363  modified();
364  return ret;
365 }
366 
368 
371 void Loop::getReadyTasks(std::vector<Task *>& tasks)
372 {
373  if(!_node)
374  return;
375  /*
376  * To change the way ComposedNode state is handled, uncomment the following line
377  * see Bloc::getReadyTasks
378  */
383  else
384  {
385  _node->getReadyTasks(tasks);
386  for(set<DSToDFForLoop *>::iterator iter1=_inputsTraducer.begin();iter1!=_inputsTraducer.end();iter1++)
387  (*iter1)->getReadyTasks(tasks);
388  for(set<DFToDSForLoop *>::iterator iter2=_outputsTraducer.begin();iter2!=_outputsTraducer.end();iter2++)
389  (*iter2)->getReadyTasks(tasks);
390  }
391 }
392 
394 {
396  if(_node==node)
397  _node=0;
398  modified();
399 }
400 
401 std::list<Node *> Loop::edGetDirectDescendants() const
402 {
403  list<Node *> ret;
404  if(_node)
405  ret.push_back(_node);
406  return ret;
407 }
408 
409 std::list<InputPort *> Loop::getSetOfInputPort() const
410 {
411  list<InputPort *> ret=StaticDefinedComposedNode::getSetOfInputPort();
412  ret.push_back(getDecisionPort());
413  return ret;
414 }
415 
417 {
419 }
420 
422 {
423  if(!_node)
424  return 0;
426 }
427 
429 {
430  if(_node)
431  _node->getWeightRegardingDPL(weight);
432 }
433 
435 {
436  if(_node)
437  _node->partitionRegardingDPL(pd,zeMap);
438 }
439 
440 Node *Loop::getChildByShortName(const std::string& name) const
441 {
442  if (_node)
443  if(name==_node->getName())
444  return _node;
445  string what("node "); what+= name ; what+=" is not a child of loop node "; what += getName();
446  throw Exception(what);
447 }
448 
450 {
451  return type;
452 }
453 
455 {
456  return type;
457 }
458 
459 void Loop::buildDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView)
460 {
461  string typeOfPortInstance=port->getNameOfTypeOfCurrentInstance();
462  if(typeOfPortInstance!=InputPort::NAME ||
463  (typeOfPortInstance == InputPort::NAME &&
466  return ;
467  InputPort *portCasted=(InputPort *)port;
468  set<DSToDFForLoop*>::iterator iter;
469  //Determinig if a DSToDFForLoop node has already been created for delegation of 'port'
470  for(iter=_inputsTraducer.begin();iter!=_inputsTraducer.end();iter++)
471  if((*iter)->getOutputPort("")->isAlreadyInSet(portCasted))
472  break;
473  if(iter==_inputsTraducer.end())
474  {//first time that 'port' is delegated on higher level
475  pair<set<DSToDFForLoop*>::iterator, bool> iter2=_inputsTraducer.insert(new DSToDFForLoop(this,portCasted->getName(),Loop::MappingDF2DS(portCasted->edGetType())));
476  iter=iter2.first;
477  (*iter)->getOutputPort("")->addInPort(portCasted);
478  }
479  else
480  (*iter)->loopHasOneMoreRef();
481  port=(*iter)->getInputDataStreamPort("");
482 }
483 
484 void Loop::buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView)
485 {
486  string typeOfPortInstance=(port.first)->getNameOfTypeOfCurrentInstance();
487  if(typeOfPortInstance!=OutputPort::NAME ||
488  ( typeOfPortInstance == OutputPort::NAME &&
491  return ;
492  OutPort *portCasted=port.first;
493  set<DFToDSForLoop*>::iterator iter;
494  //Determinig if a DFToDSForLoop node has already been created for delegation of 'port'
495  for(iter=_outputsTraducer.begin();iter!=_outputsTraducer.end();iter++)
496  if(portCasted->isAlreadyLinkedWith((*iter)->getInputPort("")))
497  break;
498  DFToDSForLoop *kl;
499  if(iter==_outputsTraducer.end())
500  {//first time that 'port' is delegated on higher level
501  //_outputsTraducer.insert(new DFToDSForLoop(this,portCasted->getName(),portCasted->edGetType()));
502  kl=new DFToDSForLoop(this,portCasted->getName(),portCasted->edGetType());
503  pair<set<DFToDSForLoop*>::iterator, bool> iter2=_outputsTraducer.insert(kl);
504  iter=iter2.first;
505  portCasted->addInPort((*iter)->getInputPort(""));
506  }
507  else
508  {
509  kl=*iter;
510  kl->loopHasOneMoreRef();
511  }
512  edAddLink(isInMyDescendance((port.first)->getNode())->getOutGate(),kl->getInGate());
513  port.first=(*iter)->getOutputDataStreamPort("");
514 }
515 
516 void Loop::getDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView)
517 {
518  string typeOfPortInstance=port->getNameOfTypeOfCurrentInstance();
519  if(typeOfPortInstance!=InputPort::NAME ||
520  (typeOfPortInstance == InputPort::NAME &&
523  return ;
524  InputPort *portCasted=(InputPort *)port;
525  set<DSToDFForLoop*>::iterator iter;
526  for(iter=_inputsTraducer.begin();iter!=_inputsTraducer.end();iter++)
527  if((*iter)->getOutputPort("")->isAlreadyInSet(portCasted))
528  break;
529  if(iter==_inputsTraducer.end())
530  {
531  string what("Loop::getDelegateOf : Port with name "); what+=portCasted->getName(); what+=" not exported by loop "; what+=_name;
532  throw Exception(what);
533  }
534  else
535  port=(*iter)->getInputDataStreamPort("");
536 }
537 
538 void Loop::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget,
539  const std::list<ComposedNode *>& pointsOfView)
540 {
541  string typeOfPortInstance=(port.first)->getNameOfTypeOfCurrentInstance();
542  if(typeOfPortInstance!=OutputPort::NAME ||
543  ( typeOfPortInstance == OutputPort::NAME &&
546  return ;
547  OutPort *portCasted=port.first;
548  set<DFToDSForLoop*>::iterator iter;
549  for(iter=_outputsTraducer.begin();iter!=_outputsTraducer.end();iter++)
550  if(portCasted->isAlreadyLinkedWith((*iter)->getInputPort("")))
551  break;
552  if(iter==_outputsTraducer.end())
553  {
554  string what("Loop::getDelegateOf : Port with name "); what+=portCasted->getName(); what+=" not exported by loop "; what+=_name;
555  throw Exception(what);
556  }
557  else
558  port.first=(*iter)->getOutputDataStreamPort("");
559 }
560 
561 void Loop::releaseDelegateOf(InPort * & port, OutPort *initialStart, const std::list<ComposedNode *>& pointsOfView)
562 {
563  string typeOfPortInstance=port->getNameOfTypeOfCurrentInstance();
564  if(typeOfPortInstance!=InputPort::NAME ||
565  ( typeOfPortInstance == InputPort::NAME &&
568  return ;
569  InputPort *portCasted=(InputPort *)port;
570  set<DSToDFForLoop*>::iterator iter;
571  for(iter=_inputsTraducer.begin();iter!=_inputsTraducer.end();iter++)
572  if((*iter)->getOutputPort("")->isAlreadyInSet(portCasted))
573  break;
574  if(iter==_inputsTraducer.end())
575  {
576  string what("Loop::releaseDelegateOf Port with name "); what+=portCasted->getName(); what+=" not exported by loop "; what+=_name;
577  throw Exception(what);
578  }
579  else
580  {
581  port=(*iter)->getInputDataStreamPort("");
582  if((*iter)->loopHasOneLessRef())
583  {
584  (*iter)->getOutputPort("")->removeInPort(portCasted,false);
585  delete (*iter);
586  _inputsTraducer.erase(iter);
587  }
588  }
589 }
590 
591 void Loop::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView)
592 {
593  if(portDwn==portUp)
594  return ;
595  set<DFToDSForLoop*>::iterator iter;
596  for(iter=_outputsTraducer.begin();iter!=_outputsTraducer.end();iter++)
597  if((*iter)->getOutputDataStreamPort("")==portUp)
598  break;
599  if((*iter)->loopHasOneLessRef())
600  {
601  portDwn->removeInPort((*iter)->getInputPort(""),false);
602  delete (*iter);
603  _outputsTraducer.erase(iter);
604  }
605 }
606 
608 {
609  //throw Exception("Loop::checkNoCyclePassingThrough : Internal error occured");
610 }
611 
612 void Loop::checkCFLinks(const std::list<OutPort *>& starts, InputPort *end, unsigned char& alreadyFed, bool direction, LinkInfo& info) const
613 {
614  Node *nodeEnd=end->getNode();
615  if(nodeEnd==this)
616  {//In this case 'end' port is a special port of this (for exemple ForLoop::_nbOfTimesPort)
617  //ASSERT(!direction) see Loop::checkControlDependancy (bw only)
618  solveObviousOrDelegateCFLinks(starts,end,alreadyFed,direction,info);
619  }
620  else
621  StaticDefinedComposedNode::checkCFLinks(starts,end,alreadyFed,direction,info);
622 }
623 
630 bool Loop::isNecessaryToBuildSpecificDelegateDF2DS(const std::list<ComposedNode *>& pointsOfView)
631 {
632  bool ret=false;
633  for(list<ComposedNode *>::const_iterator iter=pointsOfView.begin();iter!=pointsOfView.end() && !ret;iter++)
634  ret=(*iter)->isRepeatedUnpredictablySeveralTimes();
635  return ret;
636 }
637 
639 
647 bool Loop::edAddDFLink(OutPort *start, InPort *end)
648 {
649  return edAddLink(start,end);
650 }
651 
653 
656 void Loop::writeDot(std::ostream &os) const
657 {
658  os << " subgraph cluster_" << getId() << " {\n" ;
659  //only one node in a loop
660  if(_node)
661  {
662  _node->writeDot(os);
663  os << getId() << " -> " << _node->getId() << ";\n";
664  }
665  os << "}\n" ;
666  os << getId() << "[fillcolor=\"" ;
668  os << getColorState(state);
669  os << "\" label=\"" << "Loop:" ;
670  os << getQualifiedName() <<"\"];\n";
671 }
672 
673 
674 void Loop::accept(Visitor *visitor)
675 {
676  visitor->visitLoop(this);
677 }
678 
679 void Loop::checkControlDependancy(OutPort *start, InPort *end, bool cross,
680  std::map < ComposedNode *, std::list < OutPort * >, SortHierarc >& fw,
681  std::vector<OutPort *>& fwCross,
682  std::map< ComposedNode *, std::list < OutPort *>, SortHierarc >& bw,
683  LinkInfo& info) const
684 {
685  //First testing if end==getDecisionPort. This is the only case possible in theory.
686  if(end!=getDecisionPort())
687  return StaticDefinedComposedNode::checkControlDependancy(start,end,cross,fw,fwCross,bw,info);
688  if(cross)
689  throw Exception("Internal error occured - cross type link detected on decision port of a loop. Forbidden !");
690  fw[(ComposedNode *)this].push_back(start);
691 }
692 
694 {
695  DEBTRACE("Loop::checkBasicConsistency");
697  if(!_node)
698  throw Exception("For a loop, internal node is mandatory");
699 }
700 
705 void YACS::ENGINE::NbDoneLoader(Loop* node, int val)
706 {
707  node->_nbOfTurns = val;
708 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
Base class for all composed nodes.
std::list< InputPort * > getSetOfInputPort() const
void checkNoCrossHierachyWith(Node *node) const
std::string getName() const
void solveObviousOrDelegateCFLinks(const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
virtual void edRemoveChild(Node *node)
Remove a child node.
virtual void checkBasicConsistency() const
void init(bool start=true)
bool edAddLink(OutPort *start, InPort *end)
Add a dataflow link between two data ports.
Node * isInMyDescendance(Node *nodeToTest) const
Returns the parent of a node that is the direct child of this node.
virtual void checkCFLinks(const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
check control flow links
DFToDSForLoop(Loop *loop, const std::string &name, TypeCode *type)
Definition: Loop.cxx:108
InputPort * getInputPort(const std::string &name) const
Definition: Loop.cxx:125
void getReadyTasks(std::vector< Task * > &tasks)
Definition: Loop.cxx:121
OutputDataStreamPort * getOutputDataStreamPort(const std::string &name) const
Definition: Loop.cxx:136
Node * simpleClone(ComposedNode *father, bool editionOnly=true) const
Definition: Loop.cxx:151
void getReadyTasks(std::vector< Task * > &tasks)
Definition: Loop.cxx:226
DSToDFForLoop(Loop *loop, const std::string &name, TypeCode *type)
Definition: Loop.cxx:208
Node * simpleClone(ComposedNode *father, bool editionOnly=true) const
Definition: Loop.cxx:216
OutputPort * getOutputPort(const std::string &name) const
Definition: Loop.cxx:230
InputDataStreamPort * getInputDataStreamPort(const std::string &name) const
Definition: Loop.cxx:236
std::string getNameOfTypeOfCurrentInstance() const
Definition: DataPort.cxx:56
TypeCode * edGetType() const
Definition: DataPort.hxx:53
std::string getName() const
Definition: DataPort.hxx:55
Base class for all calculation nodes.
std::list< InputPort * > _setOfInputPort
std::list< OutputDataStreamPort * > _setOfOutputDataStreamPort
std::list< InputDataStreamPort * > _setOfInputDataStreamPort
std::list< OutputPort * > _setOfOutputPort
void getReadyTasks(std::vector< Task * > &tasks)
Node * simpleClone(ComposedNode *father, bool editionOnly) const
Definition: Loop.cxx:265
FakeNodeForLoop(Loop *loop, bool normalFinish, bool internalError=false)
Definition: Loop.cxx:251
virtual std::set< OutPort * > edSetOutPort() const
Returns physical backlinks NOT user backlinks.
Definition: InPort.cxx:65
void getAllRepresentants(std::set< InPort * > &repr) const
Definition: Loop.cxx:202
InputDataStreamPort4DS2DF(DSToDFForLoop *node, TypeCode *type)
Definition: Loop.cxx:195
void releaseData() override
Definition: Loop.cxx:88
InputPort4DF2DS(DFToDSForLoop *node, TypeCode *type)
Definition: Loop.cxx:37
void * get() const
Definition: Loop.cxx:50
void put(const void *data)
Definition: Loop.cxx:78
InputPort * clone(Node *newHelder) const
Definition: Loop.cxx:83
void getAllRepresentants(std::set< InPort * > &repr) const
Definition: Loop.cxx:44
Base class for Input Ports.
Definition: InputPort.hxx:44
static const char NAME[]
Definition: InputPort.hxx:48
Class that deal with list of semantics links for high level analysis.
Definition: LinkInfo.hxx:83
Base class for loop node.
Definition: Loop.hxx:147
static TypeCode * MappingDS2DF(TypeCode *type)
Definition: Loop.cxx:454
int getNumberOfInputPorts() const
Definition: Loop.cxx:416
void init(bool start=true)
Definition: Loop.cxx:319
friend class DSToDFForLoop
Definition: Loop.hxx:148
int getMaxLevelOfParallelism() const
Definition: Loop.cxx:421
Node * getChildByShortName(const std::string &name) const
Definition: Loop.cxx:440
std::set< DSToDFForLoop * > _inputsTraducer
Definition: Loop.hxx:155
Node * edSetNode(Node *DISOWNnode)
Definition: Loop.cxx:331
virtual bool edAddChild(Node *DISOWNnode)
Definition: Loop.cxx:353
void partitionRegardingDPL(const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)
Definition: Loop.cxx:434
std::list< Node * > edGetDirectDescendants() const
Definition: Loop.cxx:401
void getWeightRegardingDPL(ComplexWeight *weight)
Definition: Loop.cxx:428
void checkCFLinks(const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
check control flow links
Definition: Loop.cxx:612
void getDelegateOf(InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
Definition: Loop.cxx:516
virtual void accept(Visitor *visitor)
Definition: Loop.cxx:674
void writeDot(std::ostream &os) const
Dump the node state to a stream.
Definition: Loop.cxx:656
void checkControlDependancy(OutPort *start, InPort *end, bool cross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &fw, std::vector< OutPort * > &fwCross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &bw, LinkInfo &info) const
Definition: Loop.cxx:679
void edRemoveChild(Node *node)
Remove a child node.
Definition: Loop.cxx:393
void getReadyTasks(std::vector< Task * > &tasks)
Collect all the child nodes that are ready.
Definition: Loop.cxx:371
std::list< InputPort * > getSetOfInputPort() const
Definition: Loop.cxx:409
std::set< DFToDSForLoop * > _outputsTraducer
Definition: Loop.hxx:156
void buildDelegateOf(InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
Definition: Loop.cxx:459
static TypeCode * MappingDF2DS(TypeCode *type)
Definition: Loop.cxx:449
virtual void checkBasicConsistency() const
Definition: Loop.cxx:693
Node * edRemoveNode()
Definition: Loop.cxx:358
void checkNoCyclePassingThrough(Node *node)
Definition: Loop.cxx:607
virtual InputPort * getDecisionPort() const =0
Returns the port which value is used to take decision about the continuation of the loop.
void releaseDelegateOf(InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
Definition: Loop.cxx:561
virtual bool edAddDFLink(OutPort *start, InPort *end)
Connect an OutPort to an InPort and add control link if necessary.
Definition: Loop.cxx:647
static bool isNecessaryToBuildSpecificDelegateDF2DS(const std::list< ComposedNode * > &pointsOfView)
Definition: Loop.cxx:630
FakeNodeForLoop * _nodeForNullTurnOfLoops
Definition: Loop.hxx:154
Base class for all nodes.
Definition: Node.hxx:70
std::string _name
Definition: Node.hxx:89
virtual void exForwardFinished()
Definition: Node.cxx:386
virtual Node * simpleClone(ComposedNode *father, bool editionOnly=true) const =0
virtual int getMaxLevelOfParallelism() const =0
ComposedNode * _father
Definition: Node.hxx:90
std::string getColorState(YACS::StatesForNode state) const
Return the color associated to a state.
Definition: Node.cxx:578
virtual void getReadyTasks(std::vector< Task * > &tasks)=0
virtual InputDataStreamPort * getInputDataStreamPort(const std::string &name) const =0
OutGate * getOutGate()
Definition: Node.hxx:124
virtual void modified()
Sets Node in modified state and its father if it exists.
Definition: Node.cxx:805
std::string getQualifiedName() const
same as Node::getName() in most cases, but differs for children of switch
Definition: Node.cxx:632
virtual void getWeightRegardingDPL(ComplexWeight *weight)=0
const std::string getId() const
Definition: Node.cxx:478
virtual void init(bool start=true)
Definition: Node.cxx:102
ComposedNode * getFather() const
Definition: Node.hxx:127
virtual void writeDot(std::ostream &os) const
Dump to the input stream a dot representation of the node.
Definition: Node.cxx:611
void setState(YACS::StatesForNode theState)
Sets the given state for node.
Definition: Node.cxx:652
InGate * getInGate()
Definition: Node.hxx:123
const std::string & getName() const
Definition: Node.hxx:125
virtual InputPort * getInputPort(const std::string &name) const
Definition: Node.cxx:260
virtual void exForwardFailed()
Definition: Node.cxx:378
virtual OutputPort * getOutputPort(const std::string &name) const =0
virtual YACS::StatesForNode getEffectiveState() const
Return the node state in the context of its father.
Definition: Node.cxx:538
YACS::StatesForNode _state
Definition: Node.hxx:91
virtual void partitionRegardingDPL(const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)=0
virtual OutputDataStreamPort * getOutputDataStreamPort(const std::string &name) const =0
virtual bool isAlreadyLinkedWith(InPort *withp) const =0
virtual int removeInPort(InPort *inPort, bool forward)=0
virtual bool addInPort(InPort *inPort)=0
std::set< InPort * > edSetInPort() const
OutputPort4DS2DF(DSToDFForLoop *node, TypeCode *type)
Definition: Loop.cxx:156
void put(const void *data)
Definition: Loop.cxx:170
OutputPort * clone(Node *newHelder) const
Definition: Loop.cxx:176
void getAllRepresented(std::set< OutPort * > &represented) const
Definition: Loop.cxx:163
virtual void put(const void *data)
Definition: OutputPort.cxx:66
std::set< InPort * > edSetInPort() const
Definition: OutputPort.cxx:239
static const char NAME[]
Definition: OutputPort.hxx:79
Base class for all ports.
Definition: Port.hxx:43
Node * getNode() const
Definition: Port.hxx:46
Node * _node
Definition: Port.hxx:55
void checkControlDependancy(OutPort *start, InPort *end, bool cross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &fw, std::vector< OutPort * > &fwCross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &bw, LinkInfo &info) const
Base class for all type objects.
Definition: TypeCode.hxx:68
virtual void visitLoop(Loop *node)=0
void YACSLIBENGINE_EXPORT NbDoneLoader(Loop *node, int val)
Definition: Loop.cxx:705
StatesForNode
Definition: define.hxx:34
@ ACTIVATED
Definition: define.hxx:41
@ INTERNALERR
Definition: define.hxx:49
@ DONE
Definition: define.hxx:43
@ TOACTIVATE
Definition: define.hxx:40
@ ERROR
Definition: define.hxx:52