Version: 9.16.0
YACS::ENGINE::ForEachLoopGen Class Reference

#include <ForEachLoop.hxx>

Inheritance diagram for YACS::ENGINE::ForEachLoopGen:
Collaboration diagram for YACS::ENGINE::ForEachLoopGen:

Public Member Functions

 ForEachLoopGen (const std::string &name, TypeCode *typeOfDataSplitted, std::unique_ptr< NbBranchesAbstract > &&branchManager)
 
 ForEachLoopGen (const ForEachLoopGen &other, ComposedNode *father, bool editionOnly)
 
 ~ForEachLoopGen ()
 
void init (bool start=true)
 
void exUpdateState ()
 Update the node state. More...
 
void exUpdateProgress ()
 
void getReadyTasks (std::vector< Task * > &tasks)
 
int getNumberOfInputPorts () const
 
void checkNoCyclePassingThrough (Node *node)
 
void selectRunnableTasks (std::vector< Task * > &tasks)
 
unsigned getExecCurrentId () const
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
InputPortedGetSeqOfSamplesPort ()
 
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...
 
NodegetChildByShortName (const std::string &name) const
 
std::list< OutputPort * > getLocalOutputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
void writeDot (std::ostream &os) const
 Dump the node state to a stream. More...
 
virtual std::string typeName ()
 
virtual void resetState (int level)
 Reset the state of the node and its children depending on the parameter level. More...
 
std::string getProgress () const
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
int getCurrentIndex () const
 
int getNbOfElementsToBeProcessed () const
 
ForEachLoopPassedDatagetProcessedData () const
 
void setProcessedData (ForEachLoopPassedData *processedData)
 
std::vector< unsigned int > getPassedResults (Executor *execut, std::vector< SequenceAny * > &outputs, std::vector< std::string > &nameOfOutputs) const
 
void assignPassedResults (const std::vector< unsigned int > &passedIds, const std::vector< SequenceAny * > &passedOutputs, const std::vector< std::string > &nameOfOutputs)
 
const TypeCodegetOutputPortType (const std::string &portName) const
 
void cleanDynGraph () override
 
- Public Member Functions inherited from YACS::ENGINE::DynParaLoop
NodeedRemoveNode ()
 
NodeedRemoveInitNode ()
 
NodeedRemoveFinalizeNode ()
 
NodeedSetNode (Node *DISOWNnode)
 
NodeedSetInitNode (Node *DISOWNnode)
 
NodeedSetFinalizeNode (Node *DISOWNnode)
 
virtual bool edAddDFLink (OutPort *start, InPort *end)
 Connect an OutPort to an InPort and add control link if necessary. More...
 
void init (bool start=true)
 
InputPortedGetNbOfBranchesPort ()
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
unsigned getNumberOfEltsConsumed () const
 
int getBranchIDOfNode (Node *node) const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< OutputPort * > getLocalOutputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
OutputPortedGetSamplePort ()
 
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...
 
bool isPlacementPredictableB4Run () const
 For the moment false is returned : impovement about it coming soon. More...
 
void edRemoveChild (Node *node)
 Remove a child node. More...
 
bool isLoop () const override
 
virtual bool edAddChild (Node *DISOWNnode)
 
std::list< Node * > edGetDirectDescendants () const
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
unsigned getNumberOfBranchesCreatedDyn () const
 
NodegetChildByShortName (const std::string &name) const
 
NodegetChildByNameExec (const std::string &name, unsigned id) const
 
std::vector< Node * > getNodes () const
 
ComplexWeightgetWeight ()
 
void setWeight (double loopWeight)
 
void getWeightRegardingDPL (ComplexWeight *weight)
 
bool isMultiplicitySpecified (unsigned &value) const
 
void forceMultiplicity (unsigned value)
 
virtual void checkBasicConsistency () const
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
void accept (Visitor *visitor)
 
NodegetInitNode ()
 
NodegetExecNode ()
 
NodegetFinalizeNode ()
 
int getMaxLevelOfParallelism () const
 
void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)
 
virtual void cleanDynGraph ()
 
- 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 ()
 

Static Public Member Functions

static int getFEDeltaBetween (OutPort *start, InPort *end)
 
static void InterceptorizeNameOfPort (std::string &portName)
 
- 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)
 

Static Public Attributes

static const char NAME_OF_SPLITTERNODE [] ="splitter"
 
static const char INTERCEPTOR_STR [] ="_interceptor"
 
- 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
 

Protected Member Functions

void checkLinkPossibility (OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)
 
YACS::Event updateStateOnFinishedEventFrom (Node *node)
 Method used to notify the node that a child node has finished. More...
 
YACS::Event updateStateForInitNodeOnFinishedEventFrom (Node *node, unsigned int id)
 
YACS::Event updateStateForWorkNodeOnFinishedEventFrom (Node *node, unsigned int id, bool isNormalFinish)
 
YACS::Event updateStateForFinalizeNodeOnFinishedEventFrom (Node *node, unsigned int id)
 
YACS::Event updateStateOnFailedEventFrom (Node *node, const Executor *execInst)
 Method used to notify the node that a child node has failed. More...
 
void buildDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
void getDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
void releaseDelegateOf (OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
void pushAllSequenceValues ()
 
void createOutputOutOfScopeInterceptors (int branchNb)
 
void prepareSequenceValues (int sizeOfSamples)
 
OutPortgetDynOutPortByAbsName (int branchNb, const std::string &name)
 
void storeOutValsInSeqForOutOfScopeUse (int rank, int branchNb)
 
- Protected Member Functions inherited from YACS::ENGINE::DynParaLoop
 DynParaLoop (const std::string &name, TypeCode *typeOfDataSplitted, std::unique_ptr< NbBranchesAbstract > &&branchManager)
 
virtual ~DynParaLoop ()
 
 DynParaLoop (const DynParaLoop &other, ComposedNode *father, bool editionOnly)
 
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 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
 
virtual void checkLinkPossibility (OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)
 
void prepareInputsFromOutOfScope (int branchNb)
 
void putValueOnBranch (Any *val, unsigned branchId, bool first)
 
TypeOfNode getIdentityOfNotifyerNode (const Node *node, unsigned &id)
 
InputPortgetDynInputPortByAbsName (int branchNb, const std::string &name, bool initNodeAdmitted)
 
virtual void forwardExecStateToOriginalBody (Node *execNode)
 
virtual YACS::Event updateStateOnFailedEventFrom (Node *node, const Executor *execInst)
 Method used to notify the node that a child node has failed. More...
 
std::vector< Node * > cloneAndPlaceNodesCoherently (const std::vector< Node * > &origNodes)
 Clone nodes and make their placement consistent with the placement of the original ones. More...
 
NodecheckConsistencyAndSetNode (Node *&nodeToReplace, Node *DISOWNnode)
 This method is used to factorize methods edSetNode, edSetInitNode and edSetFinalizeNode. More...
 
NoderemoveNode (Node *&nodeToRemove)
 This method is used to factorize methods edRemoveNode, edRemoveInitNode and edRemoveFinalizeNode. More...
 
virtual void shutdown (int level)
 Stop all pending activities of the composed node. More...
 
- 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

int _currentIndex
 
SplitterNode _splitterNode
 
FakeNodeForForEachLoop_nodeForSpecialCases
 
std::vector< AnySplitOutputPort * > _outGoingPorts
 
std::vector< InterceptorInputPort * > _intecptrsForOutGoingPorts
 ports linked to node outside the current scope More...
 
unsigned _execCurrentId
 ports created for TypeCodes correctness More...
 
std::vector< SequenceAny * > _execVals
 
std::vector< std::vector< AnyInputPort * > > _execOutGoingPorts
 
ForEachLoopPassedData_passedData
 
- Protected Attributes inherited from YACS::ENGINE::DynParaLoop
Node_node
 
Node_initNode
 
Node_finalizeNode
 
unsigned _nbOfEltConsumed
 
std::vector< int > _execIds
 
std::unique_ptr< NbBranchesAbstract_nbOfBranches
 
AnyOutputPort _splittedPort
 
std::vector< Node * > _execNodes
 
std::vector< Node * > _execInitNodes
 
std::vector< Node * > _execFinalizeNodes
 
int _initializingCounter
 
int _unfinishedCounter
 
int _failedCounter
 
ComplexWeight _weight
 
double _loopWeight
 
- 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 int NOT_RUNNING_BRANCH_ID =-1
 
- Static Protected Attributes inherited from YACS::ENGINE::DynParaLoop
static const char NAME_OF_SPLITTED_SEQ_OUT [] = "evalSamples"
 
static const char OLD_NAME_OF_SPLITTED_SEQ_OUT [] = "SmplPrt"
 
- 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
 

Private Member Functions

int getFinishedId ()
 

Friends

class SplitterNode
 
class FakeNodeForForEachLoop
 

Additional Inherited Members

- Public Attributes inherited from YACS::ENGINE::Node
YACS::Colour _colour
 
- Protected Types inherited from YACS::ENGINE::DynParaLoop
enum  TypeOfNode { INIT_NODE = 5 , WORK_NODE = 6 , FINALIZE_NODE = 7 }
 
- 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

Definition at line 153 of file ForEachLoop.hxx.

Constructor & Destructor Documentation

◆ ForEachLoopGen() [1/2]

ForEachLoopGen::ForEachLoopGen ( const std::string &  name,
TypeCode typeOfDataSplitted,
std::unique_ptr< NbBranchesAbstract > &&  branchManager 
)

Definition at line 469 of file ForEachLoop.cxx.

469 :
470 DynParaLoop(name,typeOfDataSplitted,std::move(branchManager)),
471 _splitterNode(NAME_OF_SPLITTERNODE,typeOfDataSplitted,this),
473{
474}
FakeNodeForForEachLoop * _nodeForSpecialCases
ForEachLoopPassedData * _passedData
unsigned _execCurrentId
ports created for TypeCodes correctness
static const char NAME_OF_SPLITTERNODE[]
friend class DynParaLoop
Definition: Node.hxx:77

◆ ForEachLoopGen() [2/2]

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

Definition at line 476 of file ForEachLoop.cxx.

476 :DynParaLoop(other,father,editionOnly),
477 _splitterNode(other._splitterNode,this),
479{
480 int i=0;
481 if(!editionOnly)
482 for(vector<AnySplitOutputPort *>::const_iterator iter2=other._outGoingPorts.begin();iter2!=other._outGoingPorts.end();iter2++,i++)
483 {
484 AnySplitOutputPort *temp=new AnySplitOutputPort(*(*iter2),this);
486 temp->addRepr(getOutPort(other.getOutPortName((*iter2)->getRepr())),interc);
487 interc->setRepr(temp);
488 _outGoingPorts.push_back(temp);
489 _intecptrsForOutGoingPorts.push_back(interc);
490 }
491}
void addRepr(OutPort *repr, InterceptorInputPort *intercptr)
std::string getOutPortName(const OutPort *) const
OutPort * getOutPort(const std::string &name) const
std::vector< AnySplitOutputPort * > _outGoingPorts
std::vector< InterceptorInputPort * > _intecptrsForOutGoingPorts
ports linked to node outside the current scope
void setRepr(AnySplitOutputPort *repr)
Definition: ForEachLoop.cxx:83

References _intecptrsForOutGoingPorts, _outGoingPorts, YACS::ENGINE::AnySplitOutputPort::addRepr(), getOutPort(), YACS::ENGINE::ComposedNode::getOutPortName(), yacsorb.CORBAEngineTest::i, and YACS::ENGINE::InterceptorInputPort::setRepr().

◆ ~ForEachLoopGen()

ForEachLoopGen::~ForEachLoopGen ( )

Definition at line 493 of file ForEachLoop.cxx.

494{
496 for(vector<AnySplitOutputPort *>::iterator iter=_outGoingPorts.begin();iter!=_outGoingPorts.end();iter++)
497 delete *iter;
498 for(vector<InterceptorInputPort *>::iterator iter2=_intecptrsForOutGoingPorts.begin();iter2!=_intecptrsForOutGoingPorts.end();iter2++)
499 delete *iter2;
500 delete _passedData;
501}

References _intecptrsForOutGoingPorts, _outGoingPorts, _passedData, and cleanDynGraph().

Member Function Documentation

◆ assignPassedResults()

void ForEachLoopGen::assignPassedResults ( const std::vector< unsigned int > &  passedIds,
const std::vector< SequenceAny * > &  passedOutputs,
const std::vector< std::string > &  nameOfOutputs 
)

This method is typically useful for post-mortem relaunch to avoid to recompute already passed cases. This method takes in input exactly the parameters retrieved by getPassedResults method.

Definition at line 1209 of file ForEachLoop.cxx.

1210{
1211 delete _passedData;
1213 _passedData=new ForEachLoopPassedData(passedIds,passedOutputs,nameOfOutputs);
1214}

References YACS::ENGINE::DynParaLoop::_failedCounter, and _passedData.

Referenced by YACS::ENGINE::nodeParser::onEnd().

◆ buildDelegateOf()

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

Reimplemented from YACS::ENGINE::DynParaLoop.

Definition at line 918 of file ForEachLoop.cxx.

919{
920 DynParaLoop::buildDelegateOf(port,finalTarget,pointsOfView);
921 string typeOfPortInstance=(port.first)->getNameOfTypeOfCurrentInstance();
922 if(typeOfPortInstance==OutputPort::NAME)
923 {
924 vector<AnySplitOutputPort *>::iterator iter=_outGoingPorts.begin();
925 int i=0;
926 for(;iter!=_outGoingPorts.end();iter++,i++)
927 if((*iter)->getRepr()==port.first || *iter==port.first)
928 break;
929 if(iter!=_outGoingPorts.end())
930 {
931 if(*iter!=port.first)
932 {
933 (*iter)->incrRef();
934 (*iter)->addRepr(port.first,_intecptrsForOutGoingPorts[i]);
935 }
936 port.first=*iter;
937 }
938 else
939 {
940 TypeCode *tcTrad((YACS::ENGINE::TypeCode*)finalTarget->edGetType()->subContentType(getFEDeltaBetween(port.first,finalTarget)));
941 TypeCodeSeq *newTc=(TypeCodeSeq *)TypeCode::sequenceTc("","",tcTrad);
942 // The out going ports belong to the ForEachLoop, whereas
943 // the delegated port belongs to a node child of the ForEachLoop.
944 // The name of the delegated port contains dots (bloc.node.outport),
945 // whereas the name of the out going port shouldn't do.
946 std::string outputPortName(getPortName(port.first));
947 InterceptorizeNameOfPort(outputPortName);
948 AnySplitOutputPort *newPort(new AnySplitOutputPort(outputPortName,this,newTc));
949 InterceptorInputPort *intercptor(new InterceptorInputPort(outputPortName + "_in",this,tcTrad));
950 intercptor->setRepr(newPort);
951 newTc->decrRef();
952 newPort->addRepr(port.first,intercptor);
953 _outGoingPorts.push_back(newPort);
954 _intecptrsForOutGoingPorts.push_back(intercptor);
955 port.first=newPort;
956 }
957 }
958 else
959 throw Exception("ForEachLoopGen::buildDelegateOf : not implemented for DS because not specified");
960}
std::string getPortName(const PORT *port) const
TypeCode * edGetType() const
Definition: DataPort.hxx:53
void buildDelegateOf(InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
static int getFEDeltaBetween(OutPort *start, InPort *end)
static void InterceptorizeNameOfPort(std::string &portName)
static const char NAME[]
Definition: OutputPort.hxx:79
Class for sequence objects.
Definition: TypeCode.hxx:160
Base class for all type objects.
Definition: TypeCode.hxx:68
static TypeCode * sequenceTc(const char *id, const char *name, TypeCode *content)
static factory of sequence type given an id, a name and a content type
Definition: TypeCode.cxx:254
const TypeCode * subContentType(int lev) const
Definition: TypeCode.cxx:206

References _intecptrsForOutGoingPorts, _outGoingPorts, YACS::ENGINE::AnySplitOutputPort::addRepr(), YACS::ENGINE::DynParaLoop::buildDelegateOf(), YACS::ENGINE::RefCounter::decrRef(), YACS::ENGINE::DataPort::edGetType(), getFEDeltaBetween(), YACS::ENGINE::ComposedNode::getPortName(), yacsorb.CORBAEngineTest::i, InterceptorizeNameOfPort(), YACS::ENGINE::OutputPort::NAME, YACS::ENGINE::TypeCode::sequenceTc(), YACS::ENGINE::InterceptorInputPort::setRepr(), and YACS::ENGINE::TypeCode::subContentType().

◆ checkLinkPossibility()

void ForEachLoopGen::checkLinkPossibility ( OutPort start,
const std::list< ComposedNode * > &  pointsOfViewStart,
InPort end,
const std::list< ComposedNode * > &  pointsOfViewEnd 
)
protectedvirtual

Reimplemented from YACS::ENGINE::DynParaLoop.

Definition at line 1079 of file ForEachLoop.cxx.

1081{
1082 DynParaLoop::checkLinkPossibility(start, pointsOfViewStart, end, pointsOfViewEnd);
1083 if(end->getNode() == &_splitterNode)
1084 throw Exception("Illegal link within a foreach loop: \
1085the 'SmplsCollection' port cannot be linked within the scope of the loop.");
1086 if(end == _nbOfBranches->getPort())
1087 throw Exception("Illegal link within a foreach loop: \
1088the 'nbBranches' port cannot be linked within the scope of the loop.");
1089}
virtual void checkLinkPossibility(OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)
std::unique_ptr< NbBranchesAbstract > _nbOfBranches
Definition: DynParaLoop.hxx:56
Node * getNode() const
Definition: Port.hxx:46

References YACS::ENGINE::DynParaLoop::_nbOfBranches, _splitterNode, YACS::ENGINE::DynParaLoop::checkLinkPossibility(), and YACS::ENGINE::Port::getNode().

◆ checkNoCyclePassingThrough()

void ForEachLoopGen::checkNoCyclePassingThrough ( Node node)
virtual

Implements YACS::ENGINE::ComposedNode.

Definition at line 677 of file ForEachLoop.cxx.

678{
679 //TO DO
680}

◆ cleanDynGraph()

void ForEachLoopGen::cleanDynGraph ( )
overridevirtual

Reimplemented from YACS::ENGINE::DynParaLoop.

Definition at line 1015 of file ForEachLoop.cxx.

1016{
1018 for(vector< SequenceAny *>::iterator iter3=_execVals.begin();iter3!=_execVals.end();iter3++)
1019 (*iter3)->decrRef();
1020 _execVals.clear();
1021 for(vector< vector<AnyInputPort *> >::iterator iter4=_execOutGoingPorts.begin();iter4!=_execOutGoingPorts.end();iter4++)
1022 for(vector<AnyInputPort *>::iterator iter5=(*iter4).begin();iter5!=(*iter4).end();iter5++)
1023 delete *iter5;
1024 _execOutGoingPorts.clear();
1025}
virtual void cleanDynGraph()
std::vector< SequenceAny * > _execVals
std::vector< std::vector< AnyInputPort * > > _execOutGoingPorts

References _execOutGoingPorts, _execVals, and YACS::ENGINE::DynParaLoop::cleanDynGraph().

Referenced by init(), resetState(), and ~ForEachLoopGen().

◆ createOutputOutOfScopeInterceptors()

void ForEachLoopGen::createOutputOutOfScopeInterceptors ( int  branchNb)
protected

Definition at line 1062 of file ForEachLoop.cxx.

1063{
1064 vector<AnySplitOutputPort *>::iterator iter=_outGoingPorts.begin();
1065 int i=0;
1066 for(;iter!=_outGoingPorts.end();iter++,i++)
1067 {
1068 DEBTRACE( (*iter)->getName() << " " << (*iter)->edGetType()->kind() );
1069 //AnyInputPort *interceptor=new AnyInputPort((*iter)->getName(),this,(*iter)->edGetType());
1070 OutPort *portOut=getDynOutPortByAbsName(branchNb,getOutPortName(((*iter)->getRepr())));
1071 DEBTRACE( portOut->getName() );
1072 TypeCode *tc((TypeCode *)(*iter)->edGetType()->contentType());
1073 AnyInputPort *interceptor=new AnyInputPort((*iter)->getName(),this,tc);
1074 portOut->addInPort(interceptor);
1075 _execOutGoingPorts[branchNb].push_back(interceptor);
1076 }
1077}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::string getName() const
Definition: DataPort.hxx:55
OutPort * getDynOutPortByAbsName(int branchNb, const std::string &name)
virtual bool addInPort(InPort *inPort)=0

References _execOutGoingPorts, _outGoingPorts, YACS::ENGINE::OutPort::addInPort(), DEBTRACE, getDynOutPortByAbsName(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::ComposedNode::getOutPortName(), and yacsorb.CORBAEngineTest::i.

Referenced by exUpdateState().

◆ edGetSeqOfSamplesPort()

InputPort * YACS::ENGINE::ForEachLoopGen::edGetSeqOfSamplesPort ( )
inline

◆ exUpdateProgress()

void ForEachLoopGen::exUpdateProgress ( )

Definition at line 644 of file ForEachLoop.cxx.

645{
646 // emit notification to all observers registered with the dispatcher on any change of the node's state
647 sendEvent("progress");
648}
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(), updateStateForFinalizeNodeOnFinishedEventFrom(), and updateStateForWorkNodeOnFinishedEventFrom().

◆ exUpdateState()

void ForEachLoopGen::exUpdateState ( )
virtual

Update the node state.

Note
: Update the '_state' attribute. Typically called by 'this->_inGate' when 'this->_inGate' is ready.

Called by InGate::exNotifyFromPrecursor

Reimplemented from YACS::ENGINE::Node.

Definition at line 515 of file ForEachLoop.cxx.

516{
517 DEBTRACE("ForEachLoopGen::exUpdateState");
519 return;
520 if(_state == YACS::DONE)
521 return;
522 if(_inGate.exIsReady())
523 {
524 //internal graph update
525 int i;
526 int nbOfElts(_splitterNode.getNumberOfElements()),nbOfEltsDone(0);
527 int nbOfBr(_nbOfBranches->getNumberOfBranches(nbOfElts));
528 if(_passedData)
529 {
532 }
533 int nbOfEltsToDo(nbOfElts-nbOfEltsDone);
534
535 DEBTRACE("nbOfElts=" << nbOfElts);
536 DEBTRACE("nbOfBr=" << nbOfBr);
537 INFO_YACSTRACE("nbOfBr (" << getName() << ") = " << nbOfBr);
538
539 if(nbOfEltsToDo==0)
540 {
545 return ;
546 }
547 if(nbOfBr<=0)
548 {
552 return ;
553 }
554 if(nbOfBr>nbOfEltsToDo)
555 nbOfBr=nbOfEltsToDo;
556 _execNodes.resize(nbOfBr);
557 _execIds.resize(nbOfBr);
558 _execOutGoingPorts.resize(nbOfBr);
559 prepareSequenceValues(nbOfElts);
560 if(_initNode)
561 _execInitNodes.resize(nbOfBr);
563 if (_finalizeNode)
564 _execFinalizeNodes.resize(nbOfBr);
565
566 vector<Node *> origNodes;
567 origNodes.push_back(_initNode);
568 origNodes.push_back(_node);
569 origNodes.push_back(_finalizeNode);
570
571 //Conversion exceptions can be thrown by createOutputOutOfScopeInterceptors
572 //so catch them to control errors
573 try
574 {
575 for(i=0;i<nbOfBr;i++)
576 {
577 DEBTRACE( "-------------- 2" );
578 vector<Node *> clonedNodes = cloneAndPlaceNodesCoherently(origNodes);
579 if(_initNode)
580 _execInitNodes[i] = clonedNodes[0];
581 _execNodes[i] = clonedNodes[1];
582 if(_finalizeNode)
583 _execFinalizeNodes[i] = clonedNodes[2];
584 DEBTRACE( "-------------- 4" );
586 DEBTRACE( "-------------- 5" );
588 DEBTRACE( "-------------- 6" );
589 }
590 for(i=0;i<nbOfBr;i++)
591 {
592 DEBTRACE( "-------------- 1 " << i << " " << _execCurrentId);
594 int posInAbs(_execCurrentId);
595 if(_passedData)
599 DEBTRACE( "-------------- 7" );
600 }
601 if(_passedData)
602 {
605 }
606 // clean inputs data coming from the outside in _node
607 set< InPort * > portsToSetVals=getAllInPortsComingFromOutsideOfCurrentScope();
608 for(auto iter : portsToSetVals)
609 {
610 InputPort *curPortCasted=(InputPort *) iter;//Cast granted by ForEachLoopGen::buildDelegateOf(InPort)
611 if(!curPortCasted->canSafelySqueezeMemory())// this can appear strange ! if not safelySqueeze -> release. Nevertheless it is true.
612 curPortCasted->releaseData(); // these input ports have been incremented with InputPort::put into DynParaLoop::prepareInputsFromOutOfScope. So they can be released now.
613 }
614 }
615 catch(YACS::Exception& ex)
616 {
617 //ForEachLoop must be put in error and the exception rethrown to notify the caller
618 DEBTRACE( "ForEachLoopGen::exUpdateState: " << ex.what() );
620 setErrorDetails(ex.what());
622 throw;
623 }
624
625 setState(YACS::ACTIVATED); // move the calling of setState method there for adding observers for clone nodes in GUI part
626
627 //let's go
628 for(i=0;i<nbOfBr;i++)
629 if(_initNode)
630 {
631 _execInitNodes[i]->exUpdateState();
633 }
634 else
635 {
637 _execNodes[i]->exUpdateState();
638 }
639
641 }
642}
#define INFO_YACSTRACE(msg)
Definition: YacsTrace.hxx:51
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.
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope() const
List all input ports that are linked to out of scope ports.
std::vector< Node * > _execNodes
Definition: DynParaLoop.hxx:58
std::vector< Node * > cloneAndPlaceNodesCoherently(const std::vector< Node * > &origNodes)
Clone nodes and make their placement consistent with the placement of the original ones.
std::vector< int > _execIds
Definition: DynParaLoop.hxx:54
std::vector< Node * > _execFinalizeNodes
Definition: DynParaLoop.hxx:60
void prepareInputsFromOutOfScope(int branchNb)
virtual void forwardExecStateToOriginalBody(Node *execNode)
std::vector< Node * > _execInitNodes
Definition: DynParaLoop.hxx:59
void createOutputOutOfScopeInterceptors(int branchNb)
void prepareSequenceValues(int sizeOfSamples)
void checkCompatibilyWithNb(int nbOfElts) const
void checkLevel2(const std::vector< AnyInputPort * > &ports) const
int toAbsId(int localId) const
void assignAlreadyDone(const std::vector< SequenceAny * > &execVals) const
bool exIsReady() const
Definition: InGate.cxx:126
bool canSafelySqueezeMemory() const
Definition: InPort.cxx:73
Base class for Input Ports.
Definition: InputPort.hxx:44
virtual void releaseData()=0
virtual void setErrorDetails(const std::string &error)
Definition: Node.hxx:191
InGate _inGate
Definition: Node.hxx:86
void setState(YACS::StatesForNode theState)
Sets the given state for node.
Definition: Node.cxx:652
virtual void exForwardFailed()
Definition: Node.cxx:378
YACS::StatesForNode _state
Definition: Node.hxx:91
void putSplittedValueOnRankTo(int rankInSeq, int branch, bool first)
unsigned getNumberOfElements() const
@ ACTIVATED
Definition: define.hxx:41
@ DONE
Definition: define.hxx:43
@ DISABLED
Definition: define.hxx:50
@ ERROR
Definition: define.hxx:52

References _execCurrentId, YACS::ENGINE::DynParaLoop::_execFinalizeNodes, YACS::ENGINE::DynParaLoop::_execIds, YACS::ENGINE::DynParaLoop::_execInitNodes, YACS::ENGINE::DynParaLoop::_execNodes, _execOutGoingPorts, _execVals, YACS::ENGINE::DynParaLoop::_finalizeNode, YACS::ENGINE::Node::_inGate, YACS::ENGINE::DynParaLoop::_initializingCounter, YACS::ENGINE::DynParaLoop::_initNode, YACS::ENGINE::DynParaLoop::_nbOfBranches, YACS::ENGINE::DynParaLoop::_nbOfEltConsumed, YACS::ENGINE::DynParaLoop::_node, _nodeForSpecialCases, _passedData, _splitterNode, YACS::ENGINE::Node::_state, YACS::ACTIVATED, YACS::ENGINE::ForEachLoopPassedData::assignAlreadyDone(), YACS::ENGINE::InPort::canSafelySqueezeMemory(), YACS::ENGINE::ForEachLoopPassedData::checkCompatibilyWithNb(), YACS::ENGINE::ForEachLoopPassedData::checkLevel2(), YACS::ENGINE::DynParaLoop::cloneAndPlaceNodesCoherently(), createOutputOutOfScopeInterceptors(), DEBTRACE, YACS::DISABLED, YACS::DONE, YACS::ERROR, testCppPluginInvokation::ex, YACS::ENGINE::Node::exForwardFailed(), YACS::ENGINE::InGate::exIsReady(), FakeNodeForForEachLoop, YACS::ENGINE::DynParaLoop::forwardExecStateToOriginalBody(), YACS::ENGINE::ComposedNode::getAllInPortsComingFromOutsideOfCurrentScope(), YACS::ENGINE::ComposedNode::getAllOutPortsLeavingCurrentScope(), YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::SplitterNode::getNumberOfElements(), YACS::ENGINE::ForEachLoopPassedData::getNumberOfEltsAlreadyDone(), yacsorb.CORBAEngineTest::i, INFO_YACSTRACE, YACS::ENGINE::DynParaLoop::prepareInputsFromOutOfScope(), prepareSequenceValues(), YACS::ENGINE::SplitterNode::putSplittedValueOnRankTo(), YACS::ENGINE::InputPort::releaseData(), YACS::ENGINE::Node::setErrorDetails(), YACS::ENGINE::Node::setState(), and YACS::ENGINE::ForEachLoopPassedData::toAbsId().

◆ getChildByShortName()

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

Reimplemented from YACS::ENGINE::DynParaLoop.

Definition at line 728 of file ForEachLoop.cxx.

729{
730 if(name==NAME_OF_SPLITTERNODE)
731 return (Node *)&_splitterNode;
732 else
734}
Node * getChildByShortName(const std::string &name) const
Base class for all nodes.
Definition: Node.hxx:70

References _splitterNode, YACS::ENGINE::DynParaLoop::getChildByShortName(), and NAME_OF_SPLITTERNODE.

◆ getCurrentIndex()

int YACS::ENGINE::ForEachLoopGen::getCurrentIndex ( ) const
inline

Definition at line 200 of file ForEachLoop.hxx.

200{ return _currentIndex; }

Referenced by getProgressWeight().

◆ getDelegateOf()

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

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 962 of file ForEachLoop.cxx.

963{
964 string typeOfPortInstance=(port.first)->getNameOfTypeOfCurrentInstance();
965 if(typeOfPortInstance==OutputPort::NAME)
966 {
967 vector<AnySplitOutputPort *>::iterator iter=_outGoingPorts.begin();
968 for(;iter!=_outGoingPorts.end();iter++)
969 if((*iter)->getRepr()==port.first)
970 break;
971 if(iter==_outGoingPorts.end())
972 {
973 string what("ForEachLoopGen::getDelegateOf : Port with name "); what+=port.first->getName(); what+=" not exported by ForEachLoop "; what+=_name;
974 throw Exception(what);
975 }
976 else
977 port.first=(*iter);
978 }
979 else
980 throw Exception("ForEachLoopGen::getDelegateOf : not implemented because not specified");
981}
std::string _name
Definition: Node.hxx:89

References YACS::ENGINE::Node::_name, _outGoingPorts, and YACS::ENGINE::OutputPort::NAME.

◆ getDynOutPortByAbsName()

OutPort * ForEachLoopGen::getDynOutPortByAbsName ( int  branchNb,
const std::string &  name 
)
protected

Definition at line 1006 of file ForEachLoop.cxx.

1007{
1008 string portName, nodeName;
1009 splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,false);
1010 Node *staticChild = getChildByName(nodeName);
1011 return _execNodes[branchNb]->getOutPort(portName);//It's impossible(garanteed by YACS::ENGINE::ForEachLoopGen::buildDelegateOf)
1012 //that a link starting from _initNode goes out of scope of 'this'.
1013}
Node * getChildByName(const std::string &name) const
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.
static const char SEP_CHAR_IN_PORT[]
Definition: Node.hxx:94

References YACS::ENGINE::DynParaLoop::_execNodes, YACS::ENGINE::ComposedNode::getChildByName(), YACS::ENGINE::Node::SEP_CHAR_IN_PORT, and YACS::ENGINE::ComposedNode::splitNamesBySep().

Referenced by createOutputOutOfScopeInterceptors().

◆ getExecCurrentId()

unsigned YACS::ENGINE::ForEachLoopGen::getExecCurrentId ( ) const
inline

Definition at line 186 of file ForEachLoop.hxx.

186{ return _execCurrentId; } // for update progress bar on GUI part

◆ getFEDeltaBetween()

int ForEachLoopGen::getFEDeltaBetween ( OutPort start,
InPort end 
)
static

Definition at line 1216 of file ForEachLoop.cxx.

1217{
1218 Node *ns(start->getNode()),*ne(end->getNode());
1220 int ret(0);
1221 Node *work(ns);
1222 while(work!=co)
1223 {
1224 ForEachLoopGen *isFE(dynamic_cast<ForEachLoopGen *>(work));
1225 if(isFE)
1226 ret++;
1227 work=work->getFather();
1228 }
1229 if(dynamic_cast<AnySplitOutputPort *>(start))
1230 ret--;
1231 return ret;
1232}
Base class for all composed nodes.
static ComposedNode * getLowestCommonAncestor(Node *node1, Node *node2)
Retrieves the lowest common ancestor of 2 nodes.

References YACS::ENGINE::Node::getFather(), YACS::ENGINE::ComposedNode::getLowestCommonAncestor(), and YACS::ENGINE::Port::getNode().

Referenced by buildDelegateOf().

◆ getFinishedId()

◆ getInputPort()

InputPort * ForEachLoopGen::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::DynParaLoop.

Definition at line 700 of file ForEachLoop.cxx.

701{
704 else
705 return DynParaLoop::getInputPort(name);
706}
InputPort * getInputPort(const std::string &name) const
Get an input port given its name.
static const char NAME_OF_SEQUENCE_INPUT[]
Definition: ForEachLoop.hxx:93

References YACS::ENGINE::SplitterNode::_dataPortToDispatch, _splitterNode, YACS::ENGINE::DynParaLoop::getInputPort(), and YACS::ENGINE::SplitterNode::NAME_OF_SEQUENCE_INPUT.

Referenced by YACS::ENGINE::portParser::onEnd().

◆ getLocalInputPorts()

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

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

Reimplemented from YACS::ENGINE::DynParaLoop.

Definition at line 693 of file ForEachLoop.cxx.

694{
695 list<InputPort *> ret=DynParaLoop::getLocalInputPorts();
697 return ret;
698}
std::list< InputPort * > getLocalInputPorts() const
redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself

References YACS::ENGINE::SplitterNode::_dataPortToDispatch, _splitterNode, and YACS::ENGINE::DynParaLoop::getLocalInputPorts().

Referenced by YACS::ENGINE::VisitorSalomeSaveState::visitForEachLoop().

◆ getLocalOutputPorts()

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

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

Reimplemented from YACS::ENGINE::DynParaLoop.

Definition at line 1091 of file ForEachLoop.cxx.

1092{
1093 list<OutputPort *> ret;
1094 ret.push_back(getOutputPort(NAME_OF_SPLITTED_SEQ_OUT));
1095 return ret;
1096}
static const char NAME_OF_SPLITTED_SEQ_OUT[]
Definition: DynParaLoop.hxx:67
OutputPort * getOutputPort(const std::string &name) const
Get an output port given its name.

References getOutputPort(), and YACS::ENGINE::DynParaLoop::NAME_OF_SPLITTED_SEQ_OUT.

◆ getNbOfElementsToBeProcessed()

int ForEachLoopGen::getNbOfElementsToBeProcessed ( ) const

Definition at line 1163 of file ForEachLoop.cxx.

1164{
1165 int nbOfElems(_splitterNode.getNumberOfElements());
1166 int nbBranches = _nbOfBranches->getNumberOfBranches(nbOfElems);
1167 return nbOfElems
1168 + (_initNode ? nbBranches:0)
1169 + (_finalizeNode ? nbBranches:0) ;
1170}

References YACS::ENGINE::DynParaLoop::_finalizeNode, YACS::ENGINE::DynParaLoop::_initNode, YACS::ENGINE::DynParaLoop::_nbOfBranches, _splitterNode, and YACS::ENGINE::SplitterNode::getNumberOfElements().

Referenced by getProgress(), and getProgressWeight().

◆ getNumberOfInputPorts()

int ForEachLoopGen::getNumberOfInputPorts ( ) const
virtual

Reimplemented from YACS::ENGINE::DynParaLoop.

Definition at line 672 of file ForEachLoop.cxx.

673{
675}
int getNumberOfInputPorts() const

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

◆ getOutPort()

OutPort * ForEachLoopGen::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::DynParaLoop.

Definition at line 718 of file ForEachLoop.cxx.

719{
720 for(vector<AnySplitOutputPort *>::const_iterator iter=_outGoingPorts.begin();iter!=_outGoingPorts.end();iter++)
721 {
722 if(name==(*iter)->getName())
723 return (OutPort *)(*iter);
724 }
725 return DynParaLoop::getOutPort(name);
726}
OutPort * getOutPort(const std::string &name) const

References _outGoingPorts, and YACS::ENGINE::DynParaLoop::getOutPort().

Referenced by ForEachLoopGen().

◆ getOutputPort()

OutputPort * ForEachLoopGen::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::DynParaLoop.

Definition at line 708 of file ForEachLoop.cxx.

709{
710 for(vector<AnySplitOutputPort *>::const_iterator iter=_outGoingPorts.begin();iter!=_outGoingPorts.end();iter++)
711 {
712 if(name==(*iter)->getName())
713 return (OutputPort *)(*iter);
714 }
715 return DynParaLoop::getOutputPort(name);
716}
OutputPort * getOutputPort(const std::string &name) const
Get an output port given its name.

References _outGoingPorts, and YACS::ENGINE::DynParaLoop::getOutputPort().

Referenced by getLocalOutputPorts().

◆ getOutputPortType()

const YACS::ENGINE::TypeCode * ForEachLoopGen::getOutputPortType ( const std::string &  portName) const
Parameters
portName: "interceptorized" name of port.

Definition at line 1266 of file ForEachLoop.cxx.

1267{
1268 const YACS::ENGINE::TypeCode* ret=NULL;
1269 vector<AnySplitOutputPort *>::const_iterator it;
1270 for(it=_outGoingPorts.begin();it!=_outGoingPorts.end() && ret==NULL;it++)
1271 {
1272 std::string originalPortName(getPortName(*it));
1273 //InterceptorizeNameOfPort(originalPortName);
1274 DEBTRACE("ForEachLoopGen::getOutputPortType compare " << portName << " == " << originalPortName);
1275 if(originalPortName == portName)
1276 {
1277 ret = (*it)->edGetType()->contentType();
1278 }
1279 }
1280 return ret;
1281}
virtual const TypeCode * contentType() const
Definition: TypeCode.cxx:174

References _outGoingPorts, YACS::ENGINE::TypeCode::contentType(), DEBTRACE, and YACS::ENGINE::ComposedNode::getPortName().

Referenced by YACS::ENGINE::nodeParser::onEnd().

◆ getPassedResults()

std::vector< unsigned int > ForEachLoopGen::getPassedResults ( Executor execut,
std::vector< SequenceAny * > &  outputs,
std::vector< std::string > &  nameOfOutputs 
) const

This method allows to retrieve the state of this during execution or after. This method works even if this is NOT complete, or during execution or after a failure in this. The typical usage of this method is to retrieve the results of items that passed successfully to avoid to lose all of them if only one fails. This method has one input execut and 3 outputs.

Parameters
[in]execut- The single input is for threadsafety reasons because this method can be called safely during the execution of this.
[out]outputs- For each output ports in this linked with nodes sharing the same father than this the passed results are stored. All of the items in outputs have the same size.
[out]nameOfOutputs- The array with same size than outputs, that tells for each item in outputs the output port it refers to.
Returns
the list of ids among this->edGetSeqOfSamplesPort() that run successfully. The length of this returned array will be the length of all SequenceAny objects contained in outputs.
See also
edGetSeqOfSamplesPort

Definition at line 1186 of file ForEachLoop.cxx.

1187{
1189 if(_execVals.empty())
1190 return std::vector<unsigned int>();
1191 if(_execOutGoingPorts.empty())
1192 return std::vector<unsigned int>();
1193 std::size_t sz(_execVals.size());
1194 outputs.resize(sz);
1195 nameOfOutputs.resize(sz);
1196 const std::vector<AnyInputPort *>& ports(_execOutGoingPorts[0]);
1197 for(std::size_t i=0;i<sz;i++)
1198 {
1199 outputs[i]=_execVals[i]->removeUnsetItemsFromThis();
1200 nameOfOutputs[i]=ports[i]->getName();
1201 }
1202 return _execVals[0]->getSetItems();
1203}
YACS::BASES::Mutex & getTheMutexForSchedulerUpdate()
Definition: Executor.hxx:133

References _execOutGoingPorts, _execVals, YACS::ENGINE::Executor::getTheMutexForSchedulerUpdate(), and yacsorb.CORBAEngineTest::i.

◆ getProcessedData()

ForEachLoopPassedData * ForEachLoopGen::getProcessedData ( ) const

This method is used to obtain the values already processed by the ForEachLoop. A new ForEachLoopPassedData object is returned. You have to delete it.

Definition at line 1238 of file ForEachLoop.cxx.

1239{
1240 std::vector<SequenceAny *> outputs;
1241 std::vector<std::string> nameOfOutputs;
1242 if(_execVals.empty() || _execOutGoingPorts.empty())
1243 return new ForEachLoopPassedData(std::vector<unsigned int>(), outputs, nameOfOutputs);
1244 std::size_t sz(_execVals.size());
1245 outputs.resize(sz);
1246 nameOfOutputs.resize(sz);
1247 const std::vector<AnyInputPort *>& ports(_execOutGoingPorts[0]);
1248 for(std::size_t i=0;i<sz;i++)
1249 {
1250 outputs[i]=_execVals[i]->removeUnsetItemsFromThis();
1251 nameOfOutputs[i]=ports[i]->getName();
1252 }
1253 return new ForEachLoopPassedData(_execVals[0]->getSetItems(), outputs, nameOfOutputs);
1254}

References _execOutGoingPorts, _execVals, and yacsorb.CORBAEngineTest::i.

Referenced by YACS::ENGINE::VisitorSalomeSaveState::visitForEachLoop().

◆ getProgress()

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

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 1128 of file ForEachLoop.cxx.

1129{
1130 int nbElems(getNbOfElementsToBeProcessed());
1131 std::stringstream aProgress;
1132 if (nbElems > 0)
1133 aProgress << _currentIndex << "/" << nbElems;
1134 else
1135 aProgress << "0";
1136 return aProgress.str();
1137}
int getNbOfElementsToBeProcessed() const

References _currentIndex, and getNbOfElementsToBeProcessed().

◆ getProgressWeight()

list< ProgressWeight > ForEachLoopGen::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 elements done and the weight total by the number total of elements

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 1144 of file ForEachLoop.cxx.

1145{
1146 list<ProgressWeight> ret;
1147 list<Node *> setOfNode=edGetDirectDescendants();
1148 int elemDone=getCurrentIndex();
1149 int elemTotal=getNbOfElementsToBeProcessed();
1150 for(list<Node *>::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1151 {
1152 list<ProgressWeight> myCurrentSet=(*iter)->getProgressWeight();
1153 for(list<ProgressWeight>::iterator iter=myCurrentSet.begin();iter!=myCurrentSet.end();iter++)
1154 {
1155 (*iter).weightDone=((*iter).weightTotal) * elemDone;
1156 (*iter).weightTotal*=elemTotal;
1157 }
1158 ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
1159 }
1160 return ret;
1161}
std::list< Node * > edGetDirectDescendants() const

References YACS::ENGINE::DynParaLoop::edGetDirectDescendants(), getCurrentIndex(), and getNbOfElementsToBeProcessed().

◆ getReadyTasks()

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

Implements YACS::ENGINE::Node.

Definition at line 650 of file ForEachLoop.cxx.

651{
652 if(!_node)
653 return;
656 {
658 {
660 return ;
661 }
662 vector<Node *>::iterator iter;
663 for (iter=_execNodes.begin() ; iter!=_execNodes.end() ; iter++)
664 (*iter)->getReadyTasks(tasks);
665 for (iter=_execInitNodes.begin() ; iter!=_execInitNodes.end() ; iter++)
666 (*iter)->getReadyTasks(tasks);
667 for (iter=_execFinalizeNodes.begin() ; iter!=_execFinalizeNodes.end() ; iter++)
668 (*iter)->getReadyTasks(tasks);
669 }
670}
void getReadyTasks(std::vector< Task * > &tasks)
@ TOACTIVATE
Definition: define.hxx:40

References YACS::ENGINE::DynParaLoop::_execFinalizeNodes, YACS::ENGINE::DynParaLoop::_execInitNodes, YACS::ENGINE::DynParaLoop::_execNodes, YACS::ENGINE::DynParaLoop::_node, _nodeForSpecialCases, YACS::ENGINE::Node::_state, YACS::ACTIVATED, YACS::ENGINE::ElementaryNode::getReadyTasks(), YACS::ENGINE::Node::setState(), and YACS::TOACTIVATE.

◆ getSetOfInputPort()

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

Reimplemented from YACS::ENGINE::DynParaLoop.

Definition at line 686 of file ForEachLoop.cxx.

687{
688 list<InputPort *> ret=DynParaLoop::getSetOfInputPort();
690 return ret;
691}
std::list< InputPort * > getSetOfInputPort() const

References YACS::ENGINE::SplitterNode::_dataPortToDispatch, _splitterNode, and YACS::ENGINE::DynParaLoop::getSetOfInputPort().

◆ init()

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

◆ InterceptorizeNameOfPort()

void ForEachLoopGen::InterceptorizeNameOfPort ( std::string &  portName)
static

Definition at line 912 of file ForEachLoop.cxx.

913{
914 std::replace_if(portName.begin(), portName.end(), std::bind(std::equal_to<char>(), '.',std::placeholders::_1), '_');
915 portName += INTERCEPTOR_STR;
916}
static const char INTERCEPTOR_STR[]

References INTERCEPTOR_STR.

Referenced by buildDelegateOf().

◆ prepareSequenceValues()

void ForEachLoopGen::prepareSequenceValues ( int  sizeOfSamples)
protected

Definition at line 1046 of file ForEachLoop.cxx.

1047{
1048 _execVals.resize(_outGoingPorts.size());
1049 vector<AnySplitOutputPort *>::iterator iter=_outGoingPorts.begin();
1050 for(int i=0;iter!=_outGoingPorts.end();iter++,i++)
1051 _execVals[i]=SequenceAny::New((*iter)->edGetType()->contentType(),sizeOfSamples);
1052}
static SequenceAny * New(const std::vector< T > &vec)
Definition: Any.hxx:318

References _execVals, _outGoingPorts, yacsorb.CORBAEngineTest::i, and YACS::ENGINE::SequenceAny::New().

Referenced by exUpdateState().

◆ pushAllSequenceValues()

void ForEachLoopGen::pushAllSequenceValues ( )
protected

Definition at line 1054 of file ForEachLoop.cxx.

1055{
1056 vector<AnySplitOutputPort *>::iterator iter=_outGoingPorts.begin();
1057 int i=0;
1058 for(;iter!=_outGoingPorts.end();iter++,i++)
1059 (*iter)->put((const void *)_execVals[i]);
1060}

References _execVals, _outGoingPorts, and yacsorb.CORBAEngineTest::i.

Referenced by YACS::ENGINE::FakeNodeForForEachLoop::execute(), and updateStateForWorkNodeOnFinishedEventFrom().

◆ releaseDelegateOf()

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

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 983 of file ForEachLoop.cxx.

984{
985 string typeOfPortInstance=portDwn->getNameOfTypeOfCurrentInstance();
986 if(typeOfPortInstance==OutputPort::NAME)
987 {
988 vector<AnySplitOutputPort *>::iterator iter=_outGoingPorts.begin();
989 vector<InterceptorInputPort *>::iterator iter2=_intecptrsForOutGoingPorts.begin();
990 for(;iter!=_outGoingPorts.end();iter++,iter2++)
991 if((*iter)->getRepr()==portDwn)
992 break;
993 //ASSERT(portUp==*iter.second)
994 if((*iter)->decrRef())
995 {
996 AnySplitOutputPort *p=*iter;
997 _outGoingPorts.erase(iter);
998 delete p;
999 InterceptorInputPort *ip=*iter2;
1000 _intecptrsForOutGoingPorts.erase(iter2);
1001 delete ip;
1002 }
1003 }
1004}
std::string getNameOfTypeOfCurrentInstance() const
Definition: DataPort.cxx:56
Proc * p
Definition: driver.cxx:216

References _intecptrsForOutGoingPorts, _outGoingPorts, YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), YACS::ENGINE::OutputPort::NAME, and p.

◆ resetState()

void ForEachLoopGen::resetState ( int  level)
virtual

Reset the state of the node and its children depending on the parameter level.

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 1120 of file ForEachLoop.cxx.

1121{
1122 if(level==0)return;
1125 cleanDynGraph();
1126}
virtual void resetState(int level)
Reset the state of the node and its children depending on the parameter level.

References _execCurrentId, cleanDynGraph(), and YACS::ENGINE::ComposedNode::resetState().

◆ selectRunnableTasks()

void ForEachLoopGen::selectRunnableTasks ( std::vector< Task * > &  tasks)
virtual

Implements YACS::ENGINE::Scheduler.

Definition at line 682 of file ForEachLoop.cxx.

683{
684}

◆ setProcessedData()

void ForEachLoopGen::setProcessedData ( ForEachLoopPassedData processedData)

Definition at line 1256 of file ForEachLoop.cxx.

1257{
1258 if(_passedData)
1259 delete _passedData;
1260 _passedData = processedData;
1261}

References _passedData.

◆ storeOutValsInSeqForOutOfScopeUse()

void ForEachLoopGen::storeOutValsInSeqForOutOfScopeUse ( int  rank,
int  branchNb 
)
protected

Definition at line 1027 of file ForEachLoop.cxx.

1028{
1029 vector<AnyInputPort *>::iterator iter;
1030 int i=0;
1031 for(iter=_execOutGoingPorts[branchNb].begin();iter!=_execOutGoingPorts[branchNb].end();iter++,i++)
1032 {
1033 Any *val=(Any *)(*iter)->getValue();
1034 _execVals[i]->setEltAtRank(rank,val);
1035 }
1036}
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79

References _execOutGoingPorts, _execVals, and yacsorb.CORBAEngineTest::i.

Referenced by updateStateForWorkNodeOnFinishedEventFrom().

◆ typeName()

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

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 196 of file ForEachLoop.hxx.

196{return "YACS__ENGINE__ForEachLoop";}

◆ updateStateForFinalizeNodeOnFinishedEventFrom()

YACS::Event ForEachLoopGen::updateStateForFinalizeNodeOnFinishedEventFrom ( Node node,
unsigned int  id 
)
protected

Definition at line 881 of file ForEachLoop.cxx.

882{
883 DEBTRACE("Finalize node finished on branch " << id);
887 DEBTRACE(_unfinishedCounter << " finalize nodes still running");
888 if (_unfinishedCounter == 0)
889 {
892 return YACS::FINISH;
893 }
894 else
895 return YACS::NOEVENT;
896}
@ NOEVENT
Definition: define.hxx:57
@ FINISH
Definition: define.hxx:59

References _currentIndex, YACS::ENGINE::DynParaLoop::_finalizeNode, YACS::ENGINE::DynParaLoop::_unfinishedCounter, DEBTRACE, YACS::DONE, exUpdateProgress(), YACS::FINISH, YACS::NOEVENT, and YACS::ENGINE::Node::setState().

Referenced by updateStateOnFinishedEventFrom().

◆ updateStateForInitNodeOnFinishedEventFrom()

YACS::Event ForEachLoopGen::updateStateForInitNodeOnFinishedEventFrom ( Node node,
unsigned int  id 
)
protected

◆ updateStateForWorkNodeOnFinishedEventFrom()

YACS::Event ForEachLoopGen::updateStateForWorkNodeOnFinishedEventFrom ( Node node,
unsigned int  id,
bool  isNormalFinish 
)
protected
Parameters
[in]isNormalFinish- if true

Definition at line 775 of file ForEachLoop.cxx.

776{
779 if(isNormalFinish)
780 {
781 int globalId(_execIds[id]);
782 if(_passedData)
783 globalId=_passedData->toAbsId(globalId);
784 sendEvent2("progress_ok",&globalId);
786 }
787 else
788 {
789 int globalId(_execIds[id]);
790 if(_passedData)
791 globalId=_passedData->toAbsId(globalId);
792 sendEvent2("progress_ko",&globalId);
793 }
794 //
796 {//No more elements of _dataPortToDispatch to treat
798 //analyzing if some samples are still on treatment on other branches.
799 bool isFinished(true);
800 for(int i=0;i<_execIds.size() && isFinished;i++)
802 if(isFinished)
803 {
804 try
805 {
806 if(_failedCounter!=0)
807 {// case of keepgoing mode + a failed
808 std::ostringstream oss; oss << "Keep Going mode activated and some errors (" << _failedCounter << ")reported !";
809 DEBTRACE("ForEachLoopGen::updateStateOnFinishedEventFrom : "<< oss.str());
811 return YACS::ABORT;
812 }
814
815 if (_node)
816 {
818
819 ComposedNode* compNode = dynamic_cast<ComposedNode*>(_node);
820 if (compNode)
821 {
822 std::list<Node *> aChldn = compNode->getAllRecursiveConstituents();
823 std::list<Node *>::iterator iter=aChldn.begin();
824 for(;iter!=aChldn.end();iter++)
825 (*iter)->setState(YACS::DONE);
826 }
827 }
828
829 if (_finalizeNode == NULL)
830 {
831 // No finalize node, we just finish the loop at the end of exec nodes execution
833 return YACS::FINISH;
834 }
835 else
836 {
837 // Run the finalize nodes, the loop will be done only when they all finish
838 _unfinishedCounter = 0; // This counter indicates how many branches are not finished
839 for (int i=0 ; i<_execIds.size() ; i++)
840 {
842 DEBTRACE("Launching finalize node for branch " << i);
843 _execFinalizeNodes[i]->exUpdateState();
845 }
846 return YACS::NOEVENT;
847 }
848 }
849 catch(YACS::Exception& ex)
850 {
851 DEBTRACE("ForEachLoopGen::updateStateOnFinishedEventFrom: "<<ex.what());
852 //no way to push results : put following nodes in FAILED state
853 //TODO could be more fine grain : put only concerned nodes in FAILED state
856 return YACS::ABORT;
857 }
858 }
859 }
860 else if(_state == YACS::ACTIVATED)
861 {//more elements to do and loop still activated
863 int posInAbs(_execCurrentId);
864 if(_passedData)
866 _splitterNode.putSplittedValueOnRankTo(posInAbs,id,false);
867 //forwardExecStateToOriginalBody(node);
868 node->init(false);
870 node->exUpdateState();
871 //forwardExecStateToOriginalBody(node);
873 }
874 else
875 {//elements to process and loop no more activated
876 DEBTRACE("foreach loop state " << _state);
877 }
878 return YACS::NOEVENT;
879}
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
virtual std::list< Node * > getAllRecursiveConstituents()
Idem getAllRecursiveNodes, but this node is NOT included.
void storeOutValsInSeqForOutOfScopeUse(int rank, int branchNb)
static const int NOT_RUNNING_BRANCH_ID
virtual void sendEvent2(const std::string &event, void *something)
emit notification to all observers registered with the dispatcher
Definition: Node.cxx:709
virtual void exUpdateState()
Update the node state.
Definition: Node.cxx:206
virtual void init(bool start=true)
Definition: Node.cxx:102
@ ABORT
Definition: define.hxx:60
@ FAILED
Definition: define.hxx:51

References _currentIndex, _execCurrentId, YACS::ENGINE::DynParaLoop::_execFinalizeNodes, YACS::ENGINE::DynParaLoop::_execIds, YACS::ENGINE::DynParaLoop::_failedCounter, YACS::ENGINE::DynParaLoop::_finalizeNode, YACS::ENGINE::DynParaLoop::_nbOfEltConsumed, YACS::ENGINE::DynParaLoop::_node, _passedData, _splitterNode, YACS::ENGINE::Node::_state, YACS::ENGINE::DynParaLoop::_unfinishedCounter, YACS::ABORT, YACS::ACTIVATED, DEBTRACE, YACS::DONE, YACS::ERROR, testCppPluginInvokation::ex, YACS::ENGINE::Node::exForwardFailed(), exUpdateProgress(), YACS::ENGINE::Node::exUpdateState(), YACS::FAILED, YACS::FINISH, YACS::ENGINE::ComposedNode::getAllRecursiveConstituents(), getFinishedId(), yacsorb.CORBAEngineTest::i, YACS::ENGINE::Node::init(), YACS::ENGINE::ComposedNode::isFinished(), YACS::NOEVENT, NOT_RUNNING_BRANCH_ID, pushAllSequenceValues(), YACS::ENGINE::SplitterNode::putSplittedValueOnRankTo(), YACS::ENGINE::Node::sendEvent2(), YACS::ENGINE::Node::setState(), storeOutValsInSeqForOutOfScopeUse(), YACS::ENGINE::ForEachLoopPassedData::toAbsId(), and YASSERT.

Referenced by updateStateOnFailedEventFrom(), and updateStateOnFinishedEventFrom().

◆ updateStateOnFailedEventFrom()

YACS::Event ForEachLoopGen::updateStateOnFailedEventFrom ( Node node,
const Executor execInst 
)
protectedvirtual

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

Update the current state and return the change state

Parameters
node: the child node that has failed
Returns
the state change

Reimplemented from YACS::ENGINE::DynParaLoop.

Definition at line 898 of file ForEachLoop.cxx.

899{
900 unsigned int id;
902 // TODO: deal with keepgoing without the dependency to Executor
903 if(ton!=WORK_NODE || !execInst->getKeepGoingProperty())
904 return DynParaLoop::updateStateOnFailedEventFrom(node,execInst);
905 else
906 {
908 return updateStateForWorkNodeOnFinishedEventFrom(node,id,false);
909 }
910}
virtual YACS::Event updateStateOnFailedEventFrom(Node *node, const Executor *execInst)
Method used to notify the node that a child node has failed.
TypeOfNode getIdentityOfNotifyerNode(const Node *node, unsigned &id)
bool getKeepGoingProperty() const
Definition: Executor.hxx:107
YACS::Event updateStateForWorkNodeOnFinishedEventFrom(Node *node, unsigned int id, bool isNormalFinish)

References YACS::ENGINE::DynParaLoop::_failedCounter, YACS::ENGINE::DynParaLoop::getIdentityOfNotifyerNode(), YACS::ENGINE::Executor::getKeepGoingProperty(), updateStateForWorkNodeOnFinishedEventFrom(), YACS::ENGINE::DynParaLoop::updateStateOnFailedEventFrom(), and YACS::ENGINE::DynParaLoop::WORK_NODE.

◆ updateStateOnFinishedEventFrom()

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

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

Update the current state and return the change state

Parameters
node: the child node that has finished
Returns
the state change

Implements YACS::ENGINE::ComposedNode.

Definition at line 743 of file ForEachLoop.cxx.

744{
745 DEBTRACE("updateStateOnFinishedEventFrom " << node->getName() << " " << node->getState());
746 unsigned int id;
747 switch(getIdentityOfNotifyerNode(node,id))
748 {
749 case INIT_NODE:
751 case WORK_NODE:
753 case FINALIZE_NODE:
755 default:
756 YASSERT(false);
757 }
758 return YACS::NOEVENT;
759}
YACS::Event updateStateForInitNodeOnFinishedEventFrom(Node *node, unsigned int id)
YACS::Event updateStateForFinalizeNodeOnFinishedEventFrom(Node *node, unsigned int id)
const std::string & getName() const
Definition: Node.hxx:125
virtual YACS::StatesForNode getState() const
Definition: Node.hxx:118

References DEBTRACE, YACS::ENGINE::DynParaLoop::FINALIZE_NODE, YACS::ENGINE::DynParaLoop::getIdentityOfNotifyerNode(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Node::getState(), YACS::ENGINE::DynParaLoop::INIT_NODE, YACS::NOEVENT, updateStateForFinalizeNodeOnFinishedEventFrom(), updateStateForInitNodeOnFinishedEventFrom(), updateStateForWorkNodeOnFinishedEventFrom(), YACS::ENGINE::DynParaLoop::WORK_NODE, and YASSERT.

◆ writeDot()

void ForEachLoopGen::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 1102 of file ForEachLoop.cxx.

1103{
1104 os << " subgraph cluster_" << getId() << " {\n" ;
1105 //only one node in a loop
1106 if(_node)
1107 {
1108 _node->writeDot(os);
1109 os << getId() << " -> " << _node->getId() << ";\n";
1110 }
1111 os << "}\n" ;
1112 os << getId() << "[fillcolor=\"" ;
1114 os << getColorState(state);
1115 os << "\" label=\"" << "Loop:" ;
1116 os << getName() <<"\"];\n";
1117}
std::string getColorState(YACS::StatesForNode state) const
Return the color associated to a state.
Definition: Node.cxx:578
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 YACS::ENGINE::DynParaLoop::_node, YACS::ENGINE::Node::getColorState(), YACS::ENGINE::Node::getEffectiveState(), YACS::ENGINE::Node::getId(), YACS::ENGINE::ComposedNode::getName(), yacsorb.CORBAEngineTest::state, and YACS::ENGINE::Node::writeDot().

Friends And Related Function Documentation

◆ FakeNodeForForEachLoop

friend class FakeNodeForForEachLoop
friend

Definition at line 156 of file ForEachLoop.hxx.

Referenced by exUpdateState().

◆ SplitterNode

friend class SplitterNode
friend

Definition at line 155 of file ForEachLoop.hxx.

Member Data Documentation

◆ _currentIndex

int YACS::ENGINE::ForEachLoopGen::_currentIndex
protected

◆ _execCurrentId

unsigned YACS::ENGINE::ForEachLoopGen::_execCurrentId
protected

ports created for TypeCodes correctness

Definition at line 169 of file ForEachLoop.hxx.

Referenced by exUpdateState(), init(), resetState(), and updateStateForWorkNodeOnFinishedEventFrom().

◆ _execOutGoingPorts

std::vector< std::vector<AnyInputPort *> > YACS::ENGINE::ForEachLoopGen::_execOutGoingPorts
protected

◆ _execVals

std::vector<SequenceAny *> YACS::ENGINE::ForEachLoopGen::_execVals
protected

◆ _intecptrsForOutGoingPorts

std::vector<InterceptorInputPort *> YACS::ENGINE::ForEachLoopGen::_intecptrsForOutGoingPorts
protected

ports linked to node outside the current scope

Definition at line 167 of file ForEachLoop.hxx.

Referenced by buildDelegateOf(), ForEachLoopGen(), releaseDelegateOf(), and ~ForEachLoopGen().

◆ _nodeForSpecialCases

FakeNodeForForEachLoop* YACS::ENGINE::ForEachLoopGen::_nodeForSpecialCases
protected

Definition at line 165 of file ForEachLoop.hxx.

Referenced by exUpdateState(), and getReadyTasks().

◆ _outGoingPorts

◆ _passedData

ForEachLoopPassedData* YACS::ENGINE::ForEachLoopGen::_passedData
protected

◆ _splitterNode

◆ INTERCEPTOR_STR

const char ForEachLoopGen::INTERCEPTOR_STR ="_interceptor"
static

Definition at line 232 of file ForEachLoop.hxx.

Referenced by InterceptorizeNameOfPort().

◆ NAME_OF_SPLITTERNODE

const char ForEachLoopGen::NAME_OF_SPLITTERNODE ="splitter"
static

◆ NOT_RUNNING_BRANCH_ID

const int ForEachLoopGen::NOT_RUNNING_BRANCH_ID =-1
staticprotected

Definition at line 161 of file ForEachLoop.hxx.

Referenced by updateStateForWorkNodeOnFinishedEventFrom().


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