Version: 9.16.0
YACS::ENGINE::ForLoop Class Reference

Class for for loop node. More...

#include <ForLoop.hxx>

Inheritance diagram for YACS::ENGINE::ForLoop:
Collaboration diagram for YACS::ENGINE::ForLoop:

Public Member Functions

 ForLoop (const ForLoop &other, ComposedNode *father, bool editionOnly)
 
 ForLoop (const std::string &name)
 
void exUpdateState ()
 Update the state of the for loop. More...
 
void exUpdateProgress ()
 
void init (bool start=true)
 Initialize the node. More...
 
InputPortedGetNbOfTimesInputPort ()
 
NodesimpleClone (ComposedNode *father, bool editionOnly=true) const
 
InputPortgetInputPort (const std::string &name) const
 Get an input port given its name. More...
 
OutPortgetOutPort (const std::string &name) const
 
OutputPortgetOutputPort (const std::string &name) const
 Get an output port given its name. More...
 
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::list< OutputPort * > getSetOfOutputPort () const
 
virtual void accept (Visitor *visitor)
 
InputPortgetDecisionPort () const
 Returns the port which value is used to take decision about the continuation of the loop. More...
 
OutputPortedGetIndexPort ()
 
virtual std::string typeName ()
 
std::string getProgress () const
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
int getNbSteps () const
 
- Public Member Functions inherited from YACS::ENGINE::Loop
 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 ()
 
void init (bool start=true)
 
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)
 
virtual bool isPlacementPredictableB4Run () const =0
 
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...
 
virtual bool edAddDFLink (OutPort *start, InPort *end)
 Connect an OutPort to an InPort and add the necessary control link. More...
 
virtual bool edAddChild (Node *DISOWNnode)
 
virtual void edRemoveChild (Node *node)
 Remove a child node. 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 bool isRepeatedUnpredictablySeveralTimes () const
 
virtual bool isLoop () const
 
virtual std::list< Node * > edGetDirectDescendants () const =0
 
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 getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
std::list< InputPort * > getSetOfInputPort () 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 std::string typeName ()
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual void checkBasicConsistency () const
 
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 ()
 
void accept (Visitor *visitor)
 
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 ()
 
virtual void init (bool start=true)
 
virtual void shutdown (int level)
 Stop all pending activities of the node. More...
 
virtual void resetState (int level)
 Reset the node state depending on the parameter level. More...
 
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
 
virtual void writeDot (std::ostream &os) const
 Dump to the input stream a dot representation of the node. More...
 
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...
 
virtual void getReadyTasks (std::vector< Task * > &tasks)=0
 
virtual std::list< ElementaryNode * > getRecursiveConstituents () const =0
 
virtual std::list< ProgressWeightgetProgressWeight () const =0
 
virtual int getNumberOfInputPorts () const =0
 
virtual int getNumberOfOutputPorts () const =0
 
std::list< InPort * > getSetOfInPort () const
 
std::list< OutPort * > getSetOfOutPort () const
 
virtual std::list< InputPort * > getSetOfInputPort () const =0
 
virtual std::list< OutputPort * > getSetOfOutputPort () const =0
 
virtual std::list< InputPort * > getLocalInputPorts () const =0
 
virtual std::list< OutputPort * > getLocalOutputPorts () const =0
 
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...
 
virtual std::string getInPortName (const InPort *) const =0
 
virtual std::string getOutPortName (const OutPort *) const =0
 
virtual std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const =0
 
virtual std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const =0
 
InPortgetInPort (const std::string &name) const
 
InPropertyPortgetInPropertyPort () const
 
virtual OutPortgetOutPort (const std::string &name) const
 
virtual std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const =0
 
virtual std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const =0
 
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope () const =0
 
virtual std::vector< std::pair< InPort *, OutPort * > > getSetOfLinksComingInCurrentScope () const =0
 
virtual InputPortgetInputPort (const std::string &name) const
 
virtual OutputPortgetOutputPort (const std::string &name) const =0
 
virtual InputDataStreamPortgetInputDataStreamPort (const std::string &name) const =0
 
virtual OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const =0
 
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
 
virtual ComposedNodegetRootNode () const
 
virtual void setProperty (const std::string &name, const std::string &value)
 
virtual std::string getProperty (const std::string &name)
 
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 NodegetChildByName (const std::string &name) const =0
 
virtual ProcgetProc ()
 
virtual const ProcgetProc () const
 
virtual void accept (Visitor *visitor)=0
 
virtual int getMaxLevelOfParallelism () const =0
 
virtual void getWeightRegardingDPL (ComplexWeight *weight)=0
 
virtual void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)=0
 
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 typeName ()
 
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 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...
 
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)
 
virtual void cleanNodes ()
 Clean the node in case of not clean exit. More...
 
- Public Member Functions inherited from YACS::ENGINE::Scheduler
virtual void init (bool start=true)=0
 
virtual bool isFinished ()=0
 
virtual void exUpdateState ()=0
 
virtual std::string getName () const =0
 
virtual std::string getTaskName (Task *task) const =0
 
virtual std::vector< Task * > getNextTasks (bool &isMore)=0
 
virtual void selectRunnableTasks (std::vector< Task * > &tasks)=0
 
virtual void notifyFrom (const Task *sender, YACS::Event event, const Executor *execInst)=0
 
virtual DeploymentTree getDeploymentTree () const =0
 
virtual bool isPlacementPredictableB4Run () const =0
 
virtual bool isMultiplicitySpecified (unsigned &value) const =0
 
virtual void forceMultiplicity (unsigned value)=0
 
virtual void setProperty (const std::string &name, const std::string &value)=0
 
virtual std::string getProperty (const std::string &name)=0
 
virtual ~Scheduler ()
 

Protected Member Functions

YACS::Event updateStateOnFinishedEventFrom (Node *node)
 Method used to notify the node that a child node has ended. More...
 
void checkCFLinks (const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
 check control flow links More...
 
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::Loop
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 ()
 
virtual NodegetChildByShortName (const std::string &name) const =0
 
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)
 
virtual void buildDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
virtual void buildDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
virtual void getDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
virtual void getDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
virtual void releaseDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
virtual void releaseDelegateOf (OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
virtual void checkNoCyclePassingThrough (Node *node)=0
 
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
 
virtual 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 =0
 
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 More...
 
- Protected Member Functions inherited from YACS::ENGINE::Node
 Node (const std::string &name)
 
 Node (const Node &other, ComposedNode *father)
 
virtual void performDuplicationOfPlacement (const Node &other)=0
 performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute. More...
 
virtual void performShallowDuplicationOfPlacement (const Node &other)=0
 performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning. More...
 
virtual NodesimpleClone (ComposedNode *father, bool editionOnly=true) const =0
 
virtual void exForwardFailed ()
 
virtual void exForwardFinished ()
 
virtual void edDisconnectAllLinksWithMe ()
 

Protected Attributes

AnyInputPort _nbOfTimesPort
 
AnyOutputPort _indexPort
 
- Protected Attributes inherited from YACS::ENGINE::Loop
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
 

Static Protected Attributes

static const char NAME_OF_INDEX [] ="index"
 
static const char NAME_OF_NSTEPS_NUMBER [] ="nsteps"
 
- 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
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::Loop
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)
 
- 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 Member Functions inherited from YACS::ENGINE::Loop
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)
 

Detailed Description

Class for for loop node.

This kind of loop makes a fixed number of steps and stops

Definition at line 32 of file ForLoop.hxx.

Constructor & Destructor Documentation

◆ ForLoop() [1/2]

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

Definition at line 50 of file ForLoop.cxx.

50 :Loop(other,father,editionOnly),
52 _indexPort(other._indexPort,this)
53{
54 //Copy Data linking
55 std::vector< std::pair<OutPort *, InPort *> > linksToReproduce=other.getSetOfInternalLinks();
56 std::vector< std::pair<OutPort *, InPort *> >::iterator iter=linksToReproduce.begin();
57 for(;iter!=linksToReproduce.end();++iter)
58 {
59 OutPort* pout = iter->first;
60 InPort* pin = iter->second;
61 edAddLink(getOutPort(other.getPortName(pout)),getInPort(other.getPortName(pin)));
62 }
63}
std::vector< std::pair< OutPort *, InPort * > > getSetOfInternalLinks() const
std::string getPortName(const PORT *port) const
bool edAddLink(OutPort *start, InPort *end)
Add a dataflow link between two data ports.
OutPort * getOutPort(const std::string &name) const
Definition: ForLoop.cxx:185
AnyInputPort _nbOfTimesPort
Definition: ForLoop.hxx:37
AnyOutputPort _indexPort
Definition: ForLoop.hxx:38
InPort * getInPort(const std::string &name) const
Definition: Node.cxx:239

References YACS::ENGINE::ComposedNode::edAddLink(), YACS::ENGINE::Node::getInPort(), getOutPort(), YACS::ENGINE::ComposedNode::getPortName(), and YACS::ENGINE::ComposedNode::getSetOfInternalLinks().

Referenced by simpleClone().

◆ ForLoop() [2/2]

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

Definition at line 45 of file ForLoop.cxx.

47{
48}
static const char NAME_OF_NSTEPS_NUMBER[]
Definition: ForLoop.hxx:36
static const char NAME_OF_INDEX[]
Definition: ForLoop.hxx:35
static YACS::ENGINE::TypeCode * _tc_int
Definition: Runtime.hxx:137

Member Function Documentation

◆ accept()

void ForLoop::accept ( Visitor visitor)
virtual

Reimplemented from YACS::ENGINE::Loop.

Definition at line 173 of file ForLoop.cxx.

174{
175 visitor->visitForLoop(this);
176}
virtual void visitForLoop(ForLoop *node)=0

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

◆ checkCFLinks()

void ForLoop::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 220 of file ForLoop.cxx.

222{
223 const char what[]="ForLoop::checkCFLinks : internal error.";
224 Node *nodeEnd=end->getNode();
225 if(nodeEnd==this)
226 {//In this case 'end' port is a special port of this (for exemple ForLoop::_nbOfTimesPort)
227 solveObviousOrDelegateCFLinks(starts,end,alreadyFed,direction,info);
228 }
229 else if(isInMyDescendance(nodeEnd)==0)
230 {
231 solveObviousOrDelegateCFLinks(starts,end,alreadyFed,direction,info);
232 }
233 else
234 {//no forwarding here.
235 if(starts.size()!=1)
236 throw Exception(what);
237
238 Node *nodeStart=(*(starts.begin()))->getNode();
239 if(nodeStart==this)
240 {
241 // Link between the loop and the internal node
242 if(*(starts.begin())!=&_indexPort)
243 throw Exception(what);
244 }
245 else
246 {
247 // Link from internal node to internal node
248 if(nodeEnd!=nodeStart)
249 throw Exception(what);
250 }
251
252 if(alreadyFed==FREE_ST)
253 alreadyFed=FED_ST;
254 else if(alreadyFed==FED_ST)
255 {
256 info.pushInfoLink(*(starts.begin()),end,I_USELESS);
257 }
258 }
259}
static const unsigned char FREE_ST
void solveObviousOrDelegateCFLinks(const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
static const unsigned char FED_ST
Node * isInMyDescendance(Node *nodeToTest) const
Returns the parent of a node that is the direct child of this node.
void pushInfoLink(OutPort *semStart, InPort *end, InfoReason reason)
Definition: LinkInfo.cxx:71
Base class for all nodes.
Definition: Node.hxx:70
Node * getNode() const
Definition: Port.hxx:46

References _indexPort, YACS::ENGINE::ComposedNode::FED_ST, YACS::ENGINE::ComposedNode::FREE_ST, YACS::ENGINE::Port::getNode(), YACS::ENGINE::I_USELESS, YACS::ENGINE::ComposedNode::isInMyDescendance(), YACS::ENGINE::LinkInfo::pushInfoLink(), and YACS::ENGINE::ComposedNode::solveObviousOrDelegateCFLinks().

◆ checkControlDependancy()

void ForLoop::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 206 of file ForLoop.cxx.

211{
212 //First testing if start==indexPort. This is the only case possible in theory.
213 if(start != &_indexPort)
214 return StaticDefinedComposedNode::checkControlDependancy(start,end,cross,fw,fwCross,bw,info);
215 if(cross)
216 throw Exception("Internal error occured - cross type link detected on decision port of a loop. Forbidden !");
217 fw[(ComposedNode *)this].push_back(start);
218}
Base class for all composed nodes.
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 _indexPort, and YACS::ENGINE::StaticDefinedComposedNode::checkControlDependancy().

◆ edGetIndexPort()

OutputPort * YACS::ENGINE::ForLoop::edGetIndexPort ( )
inline

Definition at line 55 of file ForLoop.hxx.

55{ return &_indexPort; }

◆ edGetNbOfTimesInputPort()

◆ exUpdateProgress()

void ForLoop::exUpdateProgress ( )

Definition at line 167 of file ForLoop.cxx.

168{
169 // emit notification to all observers registered with the dispatcher on any change of the node's state
170 sendEvent("progress");
171}
virtual void sendEvent(const std::string &event)
emit notification to all observers registered with the dispatcher
Definition: Node.cxx:691

References YACS::ENGINE::Node::sendEvent().

Referenced by init(), and updateStateOnFinishedEventFrom().

◆ exUpdateState()

void ForLoop::exUpdateState ( )
virtual

Update the state of the for loop.

If the inGate port is ready goes to YACS::ACTIVATED state If the steps number is 0, create an special internal node

Reimplemented from YACS::ENGINE::Node.

Definition at line 103 of file ForLoop.cxx.

104{
105 DEBTRACE("ForLoop::exUpdateState " << getName() << " " << _state);
107 return;
108 if(_inGate.exIsReady())
109 {
113 {
115 _nodeForNullTurnOfLoops=new FakeNodeForLoop(this,false,true);
116 }
117 else
118 {
120 {
121 bool normalFinish=getAllOutPortsLeavingCurrentScope().empty();
123 _nodeForNullTurnOfLoops=new FakeNodeForLoop(this,normalFinish);
124 }
125 else if(_nbOfTimesPort.getIntValue()<0)
126 {
129 }
130 else
131 {
134 }
135 }
136 }
137}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::string getName() const
std::set< OutPort * > getAllOutPortsLeavingCurrentScope() const
List all output ports of children nodes that are linked to out of scope input ports.
bool exIsReady() const
Definition: InGate.cxx:126
friend class FakeNodeForLoop
Definition: Loop.hxx:149
FakeNodeForLoop * _nodeForNullTurnOfLoops
Definition: Loop.hxx:154
InGate _inGate
Definition: Node.hxx:86
virtual void exUpdateState()
Update the node state.
Definition: Node.cxx:206
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
@ DISABLED
Definition: define.hxx:50

References YACS::ENGINE::Node::_inGate, _nbOfTimesPort, YACS::ENGINE::Loop::_node, YACS::ENGINE::Loop::_nodeForNullTurnOfLoops, YACS::ENGINE::Node::_state, YACS::ACTIVATED, DEBTRACE, YACS::DISABLED, YACS::ENGINE::InGate::exIsReady(), YACS::ENGINE::Node::exUpdateState(), YACS::ENGINE::Loop::FakeNodeForLoop, YACS::ENGINE::ComposedNode::getAllOutPortsLeavingCurrentScope(), YACS::ENGINE::AnyInputPort::getIntValue(), YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::AnyInputPort::isEmpty(), and YACS::ENGINE::Node::setState().

◆ getDecisionPort()

InputPort * YACS::ENGINE::ForLoop::getDecisionPort ( ) const
inlinevirtual

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

Implements YACS::ENGINE::Loop.

Definition at line 54 of file ForLoop.hxx.

54{ return (InputPort *)&_nbOfTimesPort; }
friend class InputPort
Definition: Node.hxx:74

◆ getInputPort()

InputPort * ForLoop::getInputPort ( const std::string &  name) const
virtual

Get an input port given its name.

Contrary to YACS::ENGINE::ComposedNode::getOutputPort, this method is NOT recursive and so the leaf of type ElementaryNode aggregating this InputPort is directly invoked.

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 70 of file ForLoop.cxx.

71{
73 return Loop::getInputPort(name);
74
75}
InputPort * getInputPort(const std::string &name) const
Get an input port given its name.
Base class for Input Ports.
Definition: InputPort.hxx:44

References _nbOfTimesPort, YACS::ENGINE::ComposedNode::getInputPort(), and NAME_OF_NSTEPS_NUMBER.

◆ getLocalInputPorts()

std::list< InputPort * > ForLoop::getLocalInputPorts ( ) const
virtual

redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 178 of file ForLoop.cxx.

179{
180 list<InputPort *> ret;
181 ret.push_back((InputPort *)&_nbOfTimesPort);
182 return ret;
183}

References _nbOfTimesPort.

◆ getLocalOutputPorts()

std::list< OutputPort * > ForLoop::getLocalOutputPorts ( ) const
virtual

redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 199 of file ForLoop.cxx.

200{
201 list<OutputPort *> ret;
202 ret.push_back(getOutputPort(NAME_OF_INDEX));
203 return ret;
204}
OutputPort * getOutputPort(const std::string &name) const
Get an output port given its name.
Definition: ForLoop.cxx:192

References getOutputPort(), and NAME_OF_INDEX.

◆ getNbSteps()

int ForLoop::getNbSteps ( ) const

Definition at line 269 of file ForLoop.cxx.

270{
271 AnyInputPort* aNbStepsPort = (AnyInputPort*)&_nbOfTimesPort;
272 int nbSteps = 0;
273 if (aNbStepsPort && !aNbStepsPort->isEmpty())
274 nbSteps = aNbStepsPort->getIntValue();
275 return nbSteps;
276}

References _nbOfTimesPort, YACS::ENGINE::AnyInputPort::getIntValue(), and YACS::ENGINE::AnyInputPort::isEmpty().

Referenced by getProgress(), and getProgressWeight().

◆ getOutPort()

OutPort * ForLoop::getOutPort ( const std::string &  name) const
virtual
Note
: Contrary to getOutputPort method, this method returns the output port at highest level, possible. That is to say in some ComposedNode, like ForEachLoop or Switch, an outport inside 'this' is seen differently than the true outport.

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 185 of file ForLoop.cxx.

186{
187 if(name==NAME_OF_INDEX)
188 return (OutPort *)&_indexPort;
189 return Loop::getOutPort(name);
190}
OutPort * getOutPort(const std::string &name) const

References _indexPort, YACS::ENGINE::ComposedNode::getOutPort(), and NAME_OF_INDEX.

Referenced by ForLoop().

◆ getOutputPort()

OutputPort * ForLoop::getOutputPort ( const std::string &  name) const
virtual

Get an output port given its name.

Contrary to YACS::ENGINE::ComposedNode::getInputPort, this method is recursive and go down hierarchy step by step to complete its work.

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 192 of file ForLoop.cxx.

193{
194 if(name==NAME_OF_INDEX)
195 return (OutputPort *)&_indexPort;
196 return Loop::getOutputPort(name);
197}
OutputPort * getOutputPort(const std::string &name) const
Get an output port given its name.

References _indexPort, YACS::ENGINE::ComposedNode::getOutputPort(), and NAME_OF_INDEX.

Referenced by getLocalOutputPorts().

◆ getProgress()

std::string ForLoop::getProgress ( ) const
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 278 of file ForLoop.cxx.

279{
280 std::stringstream aProgress;
281 aProgress << "0";
282 int nbSteps = getNbSteps();
283 if (nbSteps > 0 && _nbOfTurns >= 0)
284 {
285 aProgress.str("");
286 aProgress << _nbOfTurns << "/" << nbSteps;
287 }
288 return aProgress.str();
289}
int getNbSteps() const
Definition: ForLoop.cxx:269

References YACS::ENGINE::Loop::_nbOfTurns, and getNbSteps().

◆ getProgressWeight()

list< ProgressWeight > ForLoop::getProgressWeight ( ) const
virtual

Get the progress weight for all elementary nodes.

Only elementary nodes have weight. For each node in the loop, the weight done is multiplied by the number of steps done and the weight total by the number total of steps

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 297 of file ForLoop.cxx.

298{
299 list<ProgressWeight> ret;
300 list<Node *> setOfNode=edGetDirectDescendants();
301 int nbStepsDone=getNbOfTurns();
302 int nbStepsTotal=getNbSteps();
303 for(list<Node *>::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
304 {
305 list<ProgressWeight> myCurrentSet=(*iter)->getProgressWeight();
306 for(list<ProgressWeight>::iterator iter=myCurrentSet.begin();iter!=myCurrentSet.end();iter++)
307 {
308 (*iter).weightDone=((*iter).weightTotal) * nbStepsDone;
309 (*iter).weightTotal*=nbStepsTotal;
310 }
311 ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
312 }
313 return ret;
314}
std::list< Node * > edGetDirectDescendants() const
Definition: Loop.cxx:401
int getNbOfTurns() const
Definition: Loop.hxx:162

References YACS::ENGINE::Loop::edGetDirectDescendants(), YACS::ENGINE::Loop::getNbOfTurns(), and getNbSteps().

◆ getSetOfOutputPort()

std::list< OutputPort * > ForLoop::getSetOfOutputPort ( ) const
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 261 of file ForLoop.cxx.

262{
263 list<OutputPort *> ret=ComposedNode::getSetOfOutputPort();
264 ret.push_back((OutputPort *)&_indexPort);
265 return ret;
266}
std::list< OutputPort * > getSetOfOutputPort() const

References _indexPort, and YACS::ENGINE::ComposedNode::getSetOfOutputPort().

◆ init()

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

Initialize the node.

Parameters
starta boolean flag to indicate the initialization mode

If start is true, it's a complete initialization (with port values initialization) If start is false, there is no port values initialization

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 85 of file ForLoop.cxx.

86{
87 DEBTRACE("ForLoop::init " << start);
88 Loop::init(start);
92 _indexPort.put(tmp);
93 tmp->decrRef();
95}
virtual void put(const void *data)
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
static AtomAny * New(T val)
Definition: Any.hxx:126
virtual void exInit(bool start)
Definition: InputPort.cxx:63
void init(bool start=true)
Definition: Loop.cxx:319
virtual void exInit()
Definition: OutputPort.cxx:62

References _indexPort, _nbOfTimesPort, YACS::ENGINE::Loop::_nbOfTurns, DEBTRACE, YACS::ENGINE::RefCounter::decrRef(), YACS::ENGINE::OutputPort::exInit(), YACS::ENGINE::InputPort::exInit(), exUpdateProgress(), YACS::ENGINE::Loop::init(), YACS::ENGINE::AtomAny::New(), and YACS::ENGINE::AnyOutputPort::put().

◆ simpleClone()

Node * ForLoop::simpleClone ( ComposedNode father,
bool  editionOnly = true 
) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 65 of file ForLoop.cxx.

66{
67 return new ForLoop(*this,father,editionOnly);
68}
ForLoop(const ForLoop &other, ComposedNode *father, bool editionOnly)
Definition: ForLoop.cxx:50

References ForLoop().

◆ typeName()

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

Reimplemented from YACS::ENGINE::Loop.

Definition at line 56 of file ForLoop.hxx.

56{return "YACS__ENGINE__ForLoop";}

◆ updateStateOnFinishedEventFrom()

YACS::Event ForLoop::updateStateOnFinishedEventFrom ( Node node)
protectedvirtual

Method used to notify the node that a child node has ended.

Update the loop state and return the loop change state

Parameters
node: the child node that has ended
Returns
the loop state change

Implements YACS::ENGINE::ComposedNode.

Definition at line 146 of file ForLoop.cxx.

147{
148 DEBTRACE("ForLoop::updateStateOnFinishedEventFrom " << node->getName());
151 {
153 return YACS::FINISH;
154 }
155 else
156 {
158 _indexPort.put(tmp);
159 tmp->decrRef();
161 _node->init(false);
163 }
164 return YACS::NOEVENT;
165}
const std::string & getName() const
Definition: Node.hxx:125
virtual void init(bool start=true)
Definition: Node.cxx:102
@ NOEVENT
Definition: define.hxx:57
@ FINISH
Definition: define.hxx:59
@ DONE
Definition: define.hxx:43

References _indexPort, _nbOfTimesPort, YACS::ENGINE::Loop::_nbOfTurns, YACS::ENGINE::Loop::_node, YACS::ACTIVATED, DEBTRACE, YACS::ENGINE::RefCounter::decrRef(), YACS::DONE, exUpdateProgress(), YACS::ENGINE::Node::exUpdateState(), YACS::FINISH, YACS::ENGINE::AnyInputPort::getIntValue(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Node::init(), YACS::ENGINE::AtomAny::New(), YACS::NOEVENT, YACS::ENGINE::AnyOutputPort::put(), and YACS::ENGINE::Node::setState().

Member Data Documentation

◆ _indexPort

AnyOutputPort YACS::ENGINE::ForLoop::_indexPort
protected

◆ _nbOfTimesPort

AnyInputPort YACS::ENGINE::ForLoop::_nbOfTimesPort
protected

◆ NAME_OF_INDEX

const char ForLoop::NAME_OF_INDEX ="index"
staticprotected

Definition at line 35 of file ForLoop.hxx.

Referenced by getLocalOutputPorts(), getOutPort(), and getOutputPort().

◆ NAME_OF_NSTEPS_NUMBER

const char ForLoop::NAME_OF_NSTEPS_NUMBER ="nsteps"
staticprotected

Definition at line 36 of file ForLoop.hxx.

Referenced by getInputPort().


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