Version: 9.15.0
YACS::ENGINE::Loop Class Referenceabstract

Base class for loop node. More...

#include <Loop.hxx>

Inheritance diagram for YACS::ENGINE::Loop:
Collaboration diagram for YACS::ENGINE::Loop:

Public Member Functions

 Loop (const Loop &other, ComposedNode *father, bool editionOnly)
 
 Loop (const std::string &name)
 
 ~Loop ()
 
void init (bool start=true)
 
int getNbOfTurns () const
 
NodeedSetNode (Node *DISOWNnode)
 
virtual bool edAddChild (Node *DISOWNnode)
 
bool isLoop () const override
 
NodeedRemoveNode ()
 
virtual void checkBasicConsistency () const
 
virtual InputPortgetDecisionPort () const =0
 Returns the port which value is used to take decision about the continuation of the loop. More...
 
void getReadyTasks (std::vector< Task * > &tasks)
 Collect all the child nodes that are ready. More...
 
void edRemoveChild (Node *node)
 Remove a child node. More...
 
bool isRepeatedUnpredictablySeveralTimes () const
 
std::list< Node * > edGetDirectDescendants () const
 
std::list< InputPort * > getSetOfInputPort () const
 
int getNumberOfInputPorts () const
 
int getMaxLevelOfParallelism () const
 
void getWeightRegardingDPL (ComplexWeight *weight)
 
void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)
 
NodegetChildByShortName (const std::string &name) const
 
virtual bool edAddDFLink (OutPort *start, InPort *end)
 Connect an OutPort to an InPort and add control link if necessary. More...
 
void writeDot (std::ostream &os) const
 Dump the node state to a stream. More...
 
virtual void accept (Visitor *visitor)
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::StaticDefinedComposedNode
bool isPlacementPredictableB4Run () const
 
bool isMultiplicitySpecified (unsigned &value) const
 
void forceMultiplicity (unsigned value)
 
void selectRunnableTasks (std::vector< Task * > &tasks)
 
- Public Member Functions inherited from YACS::ENGINE::ComposedNode
virtual ~ComposedNode ()
 
bool isFinished ()
 
virtual void shutdown (int level)
 Stop all pending activities of the composed node. More...
 
virtual void resetState (int level)
 Reset the state of the node and its children depending on the parameter level. More...
 
std::string getName () const
 
std::string getTaskName (Task *task) const
 
DeploymentTree getDeploymentTree () const
 Essentially for test. Use checkDeploymentTree instead to be sure that returned DeploymentTree is consistent. More...
 
DeploymentTree checkDeploymentTree (bool deep) const
 Perform check of deployment consistency of the current graph. More...
 
std::vector< Task * > getNextTasks (bool &isMore)
 
void notifyFrom (const Task *sender, YACS::Event event, const Executor *execInst)
 Notify the node a task has emitted an event. More...
 
bool edAddLink (OutPort *start, InPort *end)
 Add a dataflow link between two data ports. More...
 
bool edAddLink (OutGate *start, InGate *end)
 Add a controlflow link between two control ports. More...
 
bool edAddCFLink (Node *nodeS, Node *nodeE)
 Add a controlflow link between two nodes. More...
 
void edRemoveCFLink (Node *nodeS, Node *nodeE)
 Remove a controlflow link. More...
 
void edRemoveLink (OutPort *start, InPort *end)
 Remove a dataflow link. More...
 
void edRemoveLink (OutGate *start, InGate *end)
 Remove a controlflow link. More...
 
virtual void removeRecursivelyRedundantCL ()
 
std::list< ElementaryNode * > getRecursiveConstituents () const
 
std::list< Node * > getAllRecursiveNodes ()
 Get all children nodes elementary and composed including this node. More...
 
virtual std::list< Node * > getAllRecursiveConstituents ()
 Idem getAllRecursiveNodes, but this node is NOT included. More...
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
std::string getInPortName (const InPort *) const
 Get the input port name. More...
 
std::string getOutPortName (const OutPort *) const
 
int getNumberOfOutputPorts () const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
std::list< OutputPort * > getLocalOutputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const
 List all output ports of children nodes that are linked to out of scope input ports. More...
 
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const
 List all input ports that are linked to out of scope ports. More...
 
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const
 
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const
 
OutPortgetOutPort (const std::string &name) const
 
InputPortgetInputPort (const std::string &name) const
 Get an input port given its name. More...
 
OutputPortgetOutputPort (const std::string &name) const
 Get an output port given its name. More...
 
InputDataStreamPortgetInputDataStreamPort (const std::string &name) const
 
OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const
 
std::vector< std::pair< OutPort *, InPort * > > getSetOfInternalLinks () const
 
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope () const
 
void checkConsistency (LinkInfo &info) const
 
virtual std::vector< std::pair< InPort *, OutPort * > > getSetOfLinksComingInCurrentScope () const
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
ComposedNodegetRootNode () const
 
bool isNodeAlreadyAggregated (const Node *node) const
 Check that Node 'node' is already a direct son of this. More...
 
virtual bool isNameAlreadyUsed (const std::string &name) const
 
NodeisInMyDescendance (Node *nodeToTest) const
 Returns the parent of a node that is the direct child of this node. More...
 
std::string getChildName (const Node *node) const
 
virtual std::string getMyQualifiedName (const Node *directSon) const
 
NodegetChildByName (const std::string &name) const
 
void loaded ()
 
void connected ()
 
virtual void cleanNodes ()
 Clean the composed node in case of not clean exit. More...
 
virtual std::string getProgress () const
 
void setProperty (const std::string &name, const std::string &value) override
 
std::string getProperty (const std::string &name) override
 
- Public Member Functions inherited from YACS::ENGINE::Node
virtual ~Node ()
 
Nodeclone (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
NodecloneWithoutCompAndContDeepCpy (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
void setState (YACS::StatesForNode theState)
 Sets the given state for node. More...
 
virtual YACS::StatesForNode getState () const
 
virtual YACS::StatesForNode getEffectiveState () const
 Return the node state in the context of its father. More...
 
virtual YACS::StatesForNode getEffectiveState (const Node *) const
 Return the effective state of a node in the context of this one (its father) More...
 
std::string getColorState (YACS::StatesForNode state) const
 Return the color associated to a state. More...
 
InGategetInGate ()
 
OutGategetOutGate ()
 
const std::string & getName () const
 
void setName (const std::string &name)
 Change the name of the node. More...
 
ComposedNodegetFather () const
 
const std::string getId () const
 
bool exIsControlReady () const
 
std::list< Node * > getOutNodes () const
 
void writeDotInFile (const std::string &fileName) const
 
virtual void exUpdateState ()
 Update the node state. More...
 
virtual void exFailedState ()
 Notify this node that its execution has failed. More...
 
virtual void exDisabledState ()
 Notify this node that it has been disabled. More...
 
std::list< InPort * > getSetOfInPort () const
 
std::list< OutPort * > getSetOfOutPort () const
 
virtual std::set< InputPort * > edGetSetOfUnitializedInputPort () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
virtual bool edAreAllInputPortInitialized () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
InPortgetInPort (const std::string &name) const
 
InPropertyPortgetInPropertyPort () const
 
std::list< ComposedNode * > getAllAscendanceOf (ComposedNode *levelToStop=0) const
 
bool operator> (const Node &other) const
 
bool operator< (const Node &other) const
 
std::string getImplementation () const
 
DynParaLoopgetClosestDPLAmongAncestors () const
 
std::map< std::string, std::string > getProperties ()
 
std::map< std::string, std::string > getPropertyMap ()
 
virtual void setProperties (std::map< std::string, std::string > properties)
 
virtual ProcgetProc ()
 
virtual const ProcgetProc () const
 
std::string getQualifiedName () const
 same as Node::getName() in most cases, but differs for children of switch More...
 
int getNumId ()
 return node instance identifiant, unique for each node instance More...
 
std::vector< std::pair< std::string, int > > getDPLScopeInfo (ComposedNode *gfn)
 
virtual void applyDPLScope (ComposedNode *gfn)
 
virtual void sendEvent (const std::string &event)
 emit notification to all observers registered with the dispatcher More...
 
virtual void sendEvent2 (const std::string &event, void *something)
 emit notification to all observers registered with the dispatcher More...
 
virtual std::string getErrorDetails () const
 
virtual void setErrorDetails (const std::string &error)
 
virtual void modified ()
 Sets Node in modified state and its father if it exists. More...
 
virtual int isModified ()
 
virtual int isValid ()
 indicates if the node is valid (returns 1) or not (returns 0) More...
 
virtual std::string getContainerLog ()
 returns a string that contains the name of the container log file if it exists More...
 
virtual void ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
virtual void getCoupledNodes (std::set< Task * > &coupledNodes)
 
- Public Member Functions inherited from YACS::ENGINE::Scheduler
virtual void exUpdateState ()=0
 
virtual ~Scheduler ()
 

Static Public Member Functions

static TypeCodeMappingDF2DS (TypeCode *type)
 
static TypeCodeMappingDS2DF (TypeCode *type)
 
- Static Public Member Functions inherited from YACS::ENGINE::ComposedNode
static ComposedNodegetLowestCommonAncestor (Node *node1, Node *node2)
 Retrieves the lowest common ancestor of 2 nodes. More...
 
static std::string getLowestCommonAncestorStr (const std::string &node1, const std::string &node2)
 
- Static Public Member Functions inherited from YACS::ENGINE::Node
static std::string getStateName (YACS::StatesForNode state)
 Return the name of a state. More...
 
static void checkValidityOfNodeName (const std::string &name)
 

Protected Member Functions

void buildDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
void buildDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
void getDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
void getDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
void releaseDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
void releaseDelegateOf (OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
void checkNoCyclePassingThrough (Node *node)
 
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
 
void checkCFLinks (const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
 check control flow links More...
 
- Protected Member Functions inherited from YACS::ENGINE::StaticDefinedComposedNode
 StaticDefinedComposedNode (const std::string &name)
 
 StaticDefinedComposedNode (const StaticDefinedComposedNode &other, ComposedNode *father)
 
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
 
- Protected Member Functions inherited from YACS::ENGINE::ComposedNode
 ComposedNode (const std::string &name)
 
 ComposedNode (const ComposedNode &other, ComposedNode *father)
 
void performDuplicationOfPlacement (const Node &other)
 performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute. More...
 
void performShallowDuplicationOfPlacement (const Node &other)
 performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning. More...
 
void edDisconnectAllLinksWithMe ()
 
YACS::Event updateStateFrom (Node *node, YACS::Event event, const Executor *execInst)
 Update node state on receiving event from a node. More...
 
virtual YACS::Event updateStateOnStartEventFrom (Node *node)
 Method used to notify the node that a child node has started. More...
 
virtual YACS::Event updateStateOnFinishedEventFrom (Node *node)=0
 
virtual YACS::Event updateStateOnFailedEventFrom (Node *node, const Executor *execInst)
 Method used to notify the node that a child node has failed. More...
 
virtual void checkLinkPossibility (OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)
 
void checkInMyDescendance (Node *nodeToTest) const
 Check if a node is in the descendance of this node. More...
 
template<class PORT >
std::string getPortName (const PORT *port) const
 
void checkNoCrossHierachyWith (Node *node) const
 
virtual void performCFComputations (LinkInfo &info) const
 perform recursively all CF computations. More...
 
virtual void destructCFComputations (LinkInfo &info) const
 destroy recursively all results of initial computations. More...
 
NodegetLowestNodeDealingAll (const std::list< OutPort * > &ports) const
 
void checkLinksCoherenceRegardingControl (const std::vector< OutPort * > &starts, InputPort *end, LinkInfo &info) const
 
void solveObviousOrDelegateCFLinks (const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
 
- Protected Member Functions inherited from YACS::ENGINE::Node
 Node (const std::string &name)
 
 Node (const Node &other, ComposedNode *father)
 
virtual NodesimpleClone (ComposedNode *father, bool editionOnly=true) const =0
 
virtual void exForwardFailed ()
 
virtual void exForwardFinished ()
 

Static Protected Member Functions

static bool isNecessaryToBuildSpecificDelegateDF2DS (const std::list< ComposedNode * > &pointsOfView)
 
- Static Protected Member Functions inherited from YACS::ENGINE::ComposedNode
static bool splitNamesBySep (const std::string &globalName, const char separator[], std::string &firstPart, std::string &lastPart, bool priority)
 Splits name globalName in 2 parts using separator. More...
 
- Static Protected Member Functions inherited from YACS::ENGINE::Node
static void checkValidityOfPortName (const std::string &name)
 
static ComposedNodecheckHavingCommonFather (Node *node1, Node *node2)
 

Protected Attributes

Node_node
 
int _nbOfTurns
 
FakeNodeForLoop_nodeForNullTurnOfLoops
 
std::set< DSToDFForLoop * > _inputsTraducer
 
std::set< DFToDSForLoop * > _outputsTraducer
 
- Protected Attributes inherited from YACS::ENGINE::Node
InGate _inGate
 
OutGate _outGate
 
InPropertyPort_inPropertyPort
 
std::string _name
 
ComposedNode_father
 
YACS::StatesForNode _state
 
int _modified
 
std::string _errorDetails
 
int _numId
 
std::string _implementation
 
std::map< std::string, std::string > _propertyMap
 
Node_eventReceiver =nullptr
 

Friends

class DSToDFForLoop
 
class FakeNodeForLoop
 
void NbDoneLoader (Loop *node, int val)
 

Additional Inherited Members

- Public Attributes inherited from YACS::ENGINE::Node
YACS::Colour _colour
 
- Static Public Attributes inherited from YACS::ENGINE::ComposedNode
static const char SEP_CHAR_BTW_LEVEL [] ="."
 
- Static Public Attributes inherited from YACS::ENGINE::Node
static std::map< int, Node * > idMap
 
- Static Protected Attributes inherited from YACS::ENGINE::ComposedNode
static const unsigned char FED_ST = 2
 
static const unsigned char FREE_ST = 0
 
static const unsigned char FED_DS_ST = 1
 
- Static Protected Attributes inherited from YACS::ENGINE::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 

Detailed Description

Base class for loop node.

See also
ForLoop
WhileLoop

Definition at line 146 of file Loop.hxx.

Constructor & Destructor Documentation

◆ Loop() [1/2]

Loop::Loop ( const Loop other,
ComposedNode father,
bool  editionOnly 
)

Definition at line 299 of file Loop.cxx.

300 {
301  if(other._node)
302  _node=other._node->simpleClone(this,editionOnly);
303 }
FakeNodeForLoop * _nodeForNullTurnOfLoops
Definition: Loop.hxx:154
virtual Node * simpleClone(ComposedNode *father, bool editionOnly=true) const =0

References _node, and YACS::ENGINE::Node::simpleClone().

◆ Loop() [2/2]

Loop::Loop ( const std::string &  name)

Definition at line 305 of file Loop.cxx.

◆ ~Loop()

Loop::~Loop ( )

Definition at line 309 of file Loop.cxx.

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 }
std::set< DSToDFForLoop * > _inputsTraducer
Definition: Loop.hxx:155
std::set< DFToDSForLoop * > _outputsTraducer
Definition: Loop.hxx:156

References _inputsTraducer, _node, _nodeForNullTurnOfLoops, and _outputsTraducer.

Member Function Documentation

◆ accept()

void Loop::accept ( Visitor visitor)
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::WhileLoop, and YACS::ENGINE::ForLoop.

Definition at line 674 of file Loop.cxx.

675 {
676  visitor->visitLoop(this);
677 }
virtual void visitLoop(Loop *node)=0

References YACS::ENGINE::Visitor::visitLoop().

◆ buildDelegateOf() [1/2]

void Loop::buildDelegateOf ( InPort *&  port,
OutPort initialStart,
const std::list< ComposedNode * > &  pointsOfView 
)
protectedvirtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 459 of file Loop.cxx.

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 }
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 Input Ports.
Definition: InputPort.hxx:44
static const char NAME[]
Definition: InputPort.hxx:48
friend class DSToDFForLoop
Definition: Loop.hxx:148
static TypeCode * MappingDF2DS(TypeCode *type)
Definition: Loop.cxx:449
static bool isNecessaryToBuildSpecificDelegateDF2DS(const std::list< ComposedNode * > &pointsOfView)
Definition: Loop.cxx:630
static const char NAME[]
Definition: OutputPort.hxx:79

References _inputsTraducer, DSToDFForLoop, YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), isNecessaryToBuildSpecificDelegateDF2DS(), MappingDF2DS(), YACS::ENGINE::InputPort::NAME, and YACS::ENGINE::OutputPort::NAME.

◆ buildDelegateOf() [2/2]

void Loop::buildDelegateOf ( std::pair< OutPort *, OutPort * > &  port,
InPort finalTarget,
const std::list< ComposedNode * > &  pointsOfView 
)
protectedvirtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 484 of file Loop.cxx.

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 }
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.
OutGate * getOutGate()
Definition: Node.hxx:124
InGate * getInGate()
Definition: Node.hxx:123
virtual bool isAlreadyLinkedWith(InPort *withp) const =0
virtual bool addInPort(InPort *inPort)=0

References _outputsTraducer, YACS::ENGINE::OutPort::addInPort(), YACS::ENGINE::ComposedNode::edAddLink(), YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::Node::getInGate(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), YACS::ENGINE::Node::getOutGate(), YACS::ENGINE::OutPort::isAlreadyLinkedWith(), YACS::ENGINE::ComposedNode::isInMyDescendance(), isNecessaryToBuildSpecificDelegateDF2DS(), YACS::ENGINE::DFToDSForLoop::loopHasOneMoreRef(), YACS::ENGINE::InputPort::NAME, and YACS::ENGINE::OutputPort::NAME.

◆ checkBasicConsistency()

void Loop::checkBasicConsistency ( ) const
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 693 of file Loop.cxx.

694 {
695  DEBTRACE("Loop::checkBasicConsistency");
697  if(!_node)
698  throw Exception("For a loop, internal node is mandatory");
699 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
virtual void checkBasicConsistency() const

References _node, YACS::ENGINE::ComposedNode::checkBasicConsistency(), and DEBTRACE.

◆ checkCFLinks()

void Loop::checkCFLinks ( const std::list< OutPort * > &  starts,
InputPort end,
unsigned char &  alreadyFed,
bool  direction,
LinkInfo info 
) const
protectedvirtual

check control flow links

Parameters
startsIf different of 0, must aggregate at leat 1 element.
end:
alreadyFedin/out parameter. Indicates if 'end' ports is already and surely set or fed by an another port.
directionIf true : forward direction else backward direction.
info: informations collectedduring the check

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 612 of file Loop.cxx.

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 }
void solveObviousOrDelegateCFLinks(const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
virtual void checkCFLinks(const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
check control flow links
Base class for all nodes.
Definition: Node.hxx:70
Node * getNode() const
Definition: Port.hxx:46

References YACS::ENGINE::ComposedNode::checkCFLinks(), YACS::ENGINE::Port::getNode(), and YACS::ENGINE::ComposedNode::solveObviousOrDelegateCFLinks().

◆ checkControlDependancy()

void Loop::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
protectedvirtual

Implements YACS::ENGINE::ComposedNode.

Definition at line 679 of file Loop.cxx.

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 }
Base class for all composed nodes.
virtual InputPort * getDecisionPort() const =0
Returns the port which value is used to take decision about the continuation of the loop.
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

References YACS::ENGINE::StaticDefinedComposedNode::checkControlDependancy(), and getDecisionPort().

◆ checkNoCyclePassingThrough()

void Loop::checkNoCyclePassingThrough ( Node node)
protectedvirtual

Implements YACS::ENGINE::ComposedNode.

Definition at line 607 of file Loop.cxx.

608 {
609  //throw Exception("Loop::checkNoCyclePassingThrough : Internal error occured");
610 }

◆ edAddChild()

bool Loop::edAddChild ( Node DISOWNnode)
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 353 of file Loop.cxx.

354 {
355  return edSetNode(node);
356 }
Node * edSetNode(Node *DISOWNnode)
Definition: Loop.cxx:331

References edSetNode().

◆ edAddDFLink()

bool Loop::edAddDFLink ( OutPort start,
InPort end 
)
virtual

Connect an OutPort to an InPort and add control link if necessary.

Connect the ports with a data link (edAddLink) In a Loop don't add control flow link : use this only to add data back links

Parameters
start: the OutPort to connect
end: the InPort to connect
Returns
true if a new link has been created, false otherwise.

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 647 of file Loop.cxx.

648 {
649  return edAddLink(start,end);
650 }

References YACS::ENGINE::ComposedNode::edAddLink().

◆ edGetDirectDescendants()

std::list< Node * > Loop::edGetDirectDescendants ( ) const
virtual

Implements YACS::ENGINE::ComposedNode.

Definition at line 401 of file Loop.cxx.

402 {
403  list<Node *> ret;
404  if(_node)
405  ret.push_back(_node);
406  return ret;
407 }

References _node.

Referenced by YACS::ENGINE::ForLoop::getProgressWeight().

◆ edRemoveChild()

void Loop::edRemoveChild ( Node node)
virtual

Remove a child node.

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 393 of file Loop.cxx.

394 {
396  if(_node==node)
397  _node=0;
398  modified();
399 }
virtual void edRemoveChild(Node *node)
Remove a child node.
virtual void modified()
Sets Node in modified state and its father if it exists.
Definition: Node.cxx:805

References _node, YACS::ENGINE::ComposedNode::edRemoveChild(), and YACS::ENGINE::Node::modified().

◆ edRemoveNode()

Node * Loop::edRemoveNode ( )

Definition at line 358 of file Loop.cxx.

359 {
361  Node *ret=_node;
362  _node=0;
363  modified();
364  return ret;
365 }

References _node, YACS::ENGINE::ComposedNode::edRemoveChild(), and YACS::ENGINE::Node::modified().

◆ edSetNode()

Node * Loop::edSetNode ( Node DISOWNnode)

Definition at line 331 of file Loop.cxx.

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 }
void checkNoCrossHierachyWith(Node *node) const
ComposedNode * _father
Definition: Node.hxx:90

References YACS::ENGINE::Node::_father, _node, YACS::ENGINE::ComposedNode::checkNoCrossHierachyWith(), YACS::ENGINE::ComposedNode::edRemoveChild(), YACS::ENGINE::Node::getName(), and YACS::ENGINE::Node::modified().

Referenced by edAddChild().

◆ getChildByShortName()

Node * Loop::getChildByShortName ( const std::string &  name) const
virtual

Implements YACS::ENGINE::ComposedNode.

Definition at line 440 of file Loop.cxx.

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 }
std::string getName() const
const std::string & getName() const
Definition: Node.hxx:125

References _node, YACS::ENGINE::ComposedNode::getName(), and YACS::ENGINE::Node::getName().

◆ getDecisionPort()

virtual InputPort* YACS::ENGINE::Loop::getDecisionPort ( ) const
pure virtual

Returns the port which value is used to take decision about the continuation of the loop.

Implemented in YACS::ENGINE::WhileLoop, and YACS::ENGINE::ForLoop.

Referenced by checkControlDependancy(), and getSetOfInputPort().

◆ getDelegateOf() [1/2]

void Loop::getDelegateOf ( InPort *&  port,
OutPort initialStart,
const std::list< ComposedNode * > &  pointsOfView 
)
protectedvirtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 516 of file Loop.cxx.

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 }
std::string _name
Definition: Node.hxx:89

References _inputsTraducer, YACS::ENGINE::Node::_name, YACS::ENGINE::DataPort::getName(), YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), isNecessaryToBuildSpecificDelegateDF2DS(), YACS::ENGINE::InputPort::NAME, and YACS::ENGINE::OutputPort::NAME.

◆ getDelegateOf() [2/2]

void Loop::getDelegateOf ( std::pair< OutPort *, OutPort * > &  port,
InPort finalTarget,
const std::list< ComposedNode * > &  pointsOfView 
)
protectedvirtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 538 of file Loop.cxx.

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 }

References YACS::ENGINE::Node::_name, _outputsTraducer, YACS::ENGINE::DataPort::getName(), YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), YACS::ENGINE::OutPort::isAlreadyLinkedWith(), isNecessaryToBuildSpecificDelegateDF2DS(), YACS::ENGINE::InputPort::NAME, and YACS::ENGINE::OutputPort::NAME.

◆ getMaxLevelOfParallelism()

int Loop::getMaxLevelOfParallelism ( ) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 421 of file Loop.cxx.

422 {
423  if(!_node)
424  return 0;
426 }
virtual int getMaxLevelOfParallelism() const =0

References _node, and YACS::ENGINE::Node::getMaxLevelOfParallelism().

◆ getNbOfTurns()

◆ getNumberOfInputPorts()

int Loop::getNumberOfInputPorts ( ) const
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 416 of file Loop.cxx.

417 {
419 }

References YACS::ENGINE::ComposedNode::getNumberOfInputPorts().

◆ getReadyTasks()

void Loop::getReadyTasks ( std::vector< Task * > &  tasks)
virtual

Collect all the child nodes that are ready.

Parameters
tasks: vector of tasks to collect ready nodes

Implements YACS::ENGINE::Node.

Definition at line 371 of file Loop.cxx.

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 }
void getReadyTasks(std::vector< Task * > &tasks)
virtual void getReadyTasks(std::vector< Task * > &tasks)=0
void setState(YACS::StatesForNode theState)
Sets the given state for node.
Definition: Node.cxx:652
YACS::StatesForNode _state
Definition: Node.hxx:91
@ ACTIVATED
Definition: define.hxx:41
@ TOACTIVATE
Definition: define.hxx:40

References _inputsTraducer, _node, _nodeForNullTurnOfLoops, _outputsTraducer, YACS::ENGINE::Node::_state, YACS::ACTIVATED, YACS::ENGINE::ElementaryNode::getReadyTasks(), YACS::ENGINE::Node::getReadyTasks(), YACS::ENGINE::Node::setState(), and YACS::TOACTIVATE.

◆ getSetOfInputPort()

std::list< InputPort * > Loop::getSetOfInputPort ( ) const
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 409 of file Loop.cxx.

410 {
411  list<InputPort *> ret=StaticDefinedComposedNode::getSetOfInputPort();
412  ret.push_back(getDecisionPort());
413  return ret;
414 }
std::list< InputPort * > getSetOfInputPort() const

References getDecisionPort(), and YACS::ENGINE::ComposedNode::getSetOfInputPort().

◆ getWeightRegardingDPL()

void Loop::getWeightRegardingDPL ( ComplexWeight weight)
virtual

Implements YACS::ENGINE::Node.

Definition at line 428 of file Loop.cxx.

429 {
430  if(_node)
431  _node->getWeightRegardingDPL(weight);
432 }
virtual void getWeightRegardingDPL(ComplexWeight *weight)=0

References _node, and YACS::ENGINE::Node::getWeightRegardingDPL().

◆ init()

void Loop::init ( bool  start = true)
virtual

initialisation of all input and output ports and gates, for execution

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::WhileLoop.

Definition at line 319 of file Loop.cxx.

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 }
void init(bool start=true)
virtual void init(bool start=true)
Definition: Node.cxx:102

References _nbOfTurns, _node, _nodeForNullTurnOfLoops, YACS::ENGINE::ComposedNode::init(), and YACS::ENGINE::Node::init().

Referenced by YACS::ENGINE::ForLoop::init(), and YACS::ENGINE::WhileLoop::init().

◆ isLoop()

bool YACS::ENGINE::Loop::isLoop ( ) const
inlineoverridevirtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 166 of file Loop.hxx.

166 { return true; }

◆ isNecessaryToBuildSpecificDelegateDF2DS()

bool Loop::isNecessaryToBuildSpecificDelegateDF2DS ( const std::list< ComposedNode * > &  pointsOfView)
staticprotected
Note
: States if a DF port must be considered on an upper level in hierarchy as a DS port or not from 'pointsOfView' observers.
Returns
:
  • True : a traduction DF->DS has to be done
  • False : no traduction needed

Definition at line 630 of file Loop.cxx.

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 }

Referenced by buildDelegateOf(), getDelegateOf(), and releaseDelegateOf().

◆ isRepeatedUnpredictablySeveralTimes()

bool YACS::ENGINE::Loop::isRepeatedUnpredictablySeveralTimes ( ) const
inlinevirtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 173 of file Loop.hxx.

173 { return true; }

◆ MappingDF2DS()

TypeCode * Loop::MappingDF2DS ( TypeCode type)
static

Definition at line 449 of file Loop.cxx.

450 {
451  return type;
452 }

Referenced by buildDelegateOf(), and YACS::ENGINE::DFToDSForLoop::DFToDSForLoop().

◆ MappingDS2DF()

TypeCode * Loop::MappingDS2DF ( TypeCode type)
static

Definition at line 454 of file Loop.cxx.

455 {
456  return type;
457 }

◆ partitionRegardingDPL()

void Loop::partitionRegardingDPL ( const PartDefinition pd,
std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &  zeMap 
)
virtual

Implements YACS::ENGINE::Node.

Definition at line 434 of file Loop.cxx.

435 {
436  if(_node)
437  _node->partitionRegardingDPL(pd,zeMap);
438 }
virtual void partitionRegardingDPL(const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)=0

References _node, and YACS::ENGINE::Node::partitionRegardingDPL().

◆ releaseDelegateOf() [1/2]

void Loop::releaseDelegateOf ( InPort *&  port,
OutPort initialStart,
const std::list< ComposedNode * > &  pointsOfView 
)
protectedvirtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 561 of file Loop.cxx.

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 }

References _inputsTraducer, YACS::ENGINE::Node::_name, YACS::ENGINE::DataPort::getName(), YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), isNecessaryToBuildSpecificDelegateDF2DS(), YACS::ENGINE::InputPort::NAME, and YACS::ENGINE::OutputPort::NAME.

◆ releaseDelegateOf() [2/2]

void Loop::releaseDelegateOf ( OutPort portDwn,
OutPort portUp,
InPort finalTarget,
const std::list< ComposedNode * > &  pointsOfView 
)
protectedvirtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 591 of file Loop.cxx.

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 }
virtual int removeInPort(InPort *inPort, bool forward)=0

References _outputsTraducer, and YACS::ENGINE::OutPort::removeInPort().

◆ typeName()

virtual std::string YACS::ENGINE::Loop::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::WhileLoop, and YACS::ENGINE::ForLoop.

Definition at line 186 of file Loop.hxx.

186 {return "YACS__ENGINE__Loop";}

◆ writeDot()

void Loop::writeDot ( std::ostream &  os) const
virtual

Dump the node state to a stream.

Parameters
os: the output stream

Reimplemented from YACS::ENGINE::Node.

Definition at line 656 of file Loop.cxx.

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 }
std::string getColorState(YACS::StatesForNode state) const
Return the color associated to a state.
Definition: Node.cxx:578
std::string getQualifiedName() const
same as Node::getName() in most cases, but differs for children of switch
Definition: Node.cxx:632
const std::string getId() const
Definition: Node.cxx:478
virtual void writeDot(std::ostream &os) const
Dump to the input stream a dot representation of the node.
Definition: Node.cxx:611
virtual YACS::StatesForNode getEffectiveState() const
Return the node state in the context of its father.
Definition: Node.cxx:538
StatesForNode
Definition: define.hxx:34

References _node, YACS::ENGINE::Node::getColorState(), YACS::ENGINE::Node::getEffectiveState(), YACS::ENGINE::Node::getId(), YACS::ENGINE::Node::getQualifiedName(), yacsorb.CORBAEngineTest::state, and YACS::ENGINE::Node::writeDot().

Friends And Related Function Documentation

◆ DSToDFForLoop

friend class DSToDFForLoop
friend

Definition at line 148 of file Loop.hxx.

Referenced by buildDelegateOf().

◆ FakeNodeForLoop

friend class FakeNodeForLoop
friend

◆ NbDoneLoader

void NbDoneLoader ( Loop node,
int  val 
)
friend

Member Data Documentation

◆ _inputsTraducer

std::set<DSToDFForLoop *> YACS::ENGINE::Loop::_inputsTraducer
protected

Definition at line 155 of file Loop.hxx.

Referenced by buildDelegateOf(), getDelegateOf(), getReadyTasks(), releaseDelegateOf(), and ~Loop().

◆ _nbOfTurns

◆ _node

◆ _nodeForNullTurnOfLoops

FakeNodeForLoop* YACS::ENGINE::Loop::_nodeForNullTurnOfLoops
protected

◆ _outputsTraducer

std::set<DFToDSForLoop *> YACS::ENGINE::Loop::_outputsTraducer
protected

Definition at line 156 of file Loop.hxx.

Referenced by buildDelegateOf(), getDelegateOf(), getReadyTasks(), releaseDelegateOf(), and ~Loop().


The documentation for this class was generated from the following files: