Version: 9.16.0
YACS::ENGINE::DynParaLoop Class Reference

Base class for dynamically (fully or semifully) built graphs. More...

#include <DynParaLoop.hxx>

Inheritance diagram for YACS::ENGINE::DynParaLoop:
Collaboration diagram for YACS::ENGINE::DynParaLoop:

Public Member Functions

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 ()
 

Protected Types

enum  TypeOfNode { INIT_NODE = 5 , WORK_NODE = 6 , FINALIZE_NODE = 7 }
 

Protected Member Functions

 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

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 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
 

Additional Inherited Members

- 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::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

Base class for dynamically (fully or semifully) built graphs.

Definition at line 40 of file DynParaLoop.hxx.

Member Enumeration Documentation

◆ TypeOfNode

Enumerator
INIT_NODE 
WORK_NODE 
FINALIZE_NODE 

Definition at line 43 of file DynParaLoop.hxx.

Constructor & Destructor Documentation

◆ DynParaLoop() [1/2]

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

Definition at line 42 of file DynParaLoop.cxx.

44 _nbOfBranches(std::move(branchManager)),
46{
48}
std::unique_ptr< NbBranchesAbstract > _nbOfBranches
Definition: DynParaLoop.hxx:56
static const char NAME_OF_SPLITTED_SEQ_OUT[]
Definition: DynParaLoop.hxx:67
AnyOutputPort _splittedPort
Definition: DynParaLoop.hxx:57
friend class ComposedNode
Definition: Node.hxx:79

References _weight, and YACS::ENGINE::ComplexWeight::setDefaultLoop().

◆ ~DynParaLoop()

DynParaLoop::~DynParaLoop ( )
protectedvirtual

Definition at line 50 of file DynParaLoop.cxx.

51{
52 delete _node;
53 delete _initNode;
54 delete _finalizeNode;
55}

References _finalizeNode, _initNode, and _node.

◆ DynParaLoop() [2/2]

DynParaLoop::DynParaLoop ( const DynParaLoop other,
ComposedNode father,
bool  editionOnly 
)
protected

Definition at line 57 of file DynParaLoop.cxx.

58 : ComposedNode(other,father),_nbOfBranches(other._nbOfBranches->copy(this)),
61{
62 if(other._node)
63 _node=other._node->clone(this,editionOnly);
64 if(other._initNode)
65 _initNode=other._initNode->clone(this,editionOnly);
66 if(other._finalizeNode)
67 _finalizeNode = other._finalizeNode->clone(this,editionOnly);
68 const AnyOutputPort& startOfLinksToReproduce=other._splittedPort;
69 set<InPort *> endsOfLinksToReproduce=startOfLinksToReproduce.edSetInPort();
70 for(set<InPort *>::iterator iter=endsOfLinksToReproduce.begin();iter!=endsOfLinksToReproduce.end();iter++)
72}
std::string getPortName(const PORT *port) const
bool edAddLink(OutPort *start, InPort *end)
Add a dataflow link between two data ports.
Node * clone(ComposedNode *father, bool editionOnly=true) const
This method MUST NEVER BE VIRTUAL
Definition: Node.cxx:131
InPort * getInPort(const std::string &name) const
Definition: Node.cxx:239
std::set< InPort * > edSetInPort() const
Definition: OutputPort.cxx:239

References _finalizeNode, _initNode, _node, _splittedPort, YACS::ENGINE::Node::clone(), YACS::ENGINE::ComposedNode::edAddLink(), YACS::ENGINE::OutputPort::edSetInPort(), YACS::ENGINE::Node::getInPort(), and YACS::ENGINE::ComposedNode::getPortName().

Member Function Documentation

◆ accept()

void DynParaLoop::accept ( Visitor visitor)
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::ForEachLoop, YACS::ENGINE::ForEachLoopDyn, and YACS::ENGINE::OptimizerLoop.

Definition at line 889 of file DynParaLoop.cxx.

890{
891 visitor->visitDynParaLoop(this);
892}
virtual void visitDynParaLoop(DynParaLoop *node)=0

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

◆ buildDelegateOf() [1/2]

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

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::OptimizerLoop.

Definition at line 455 of file DynParaLoop.cxx.

456{
457 string typeOfPortInstance=port->getNameOfTypeOfCurrentInstance();
458 if(typeOfPortInstance!=InputPort::NAME)
459 throw Exception("DynParaLoop::buildDelegateOf : A link with datastream end inside DynParaLoop is not possible");
460}
std::string getNameOfTypeOfCurrentInstance() const
Definition: DataPort.cxx:56
static const char NAME[]
Definition: InputPort.hxx:48

References YACS::ENGINE::DataPort::getNameOfTypeOfCurrentInstance(), and YACS::ENGINE::InputPort::NAME.

Referenced by YACS::ENGINE::OptimizerLoop::buildDelegateOf(), and YACS::ENGINE::ForEachLoopGen::buildDelegateOf().

◆ buildDelegateOf() [2/2]

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

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 462 of file DynParaLoop.cxx.

463{
464 std::string linkName("(");
465 linkName += port.first->getName()+" to "+finalTarget->getName()+")";
466 if(_initNode)
467 if(isInMyDescendance(port.first->getNode())==_initNode)
468 throw Exception(std::string("Illegal link within a parallel loop: \
469a link starting from the init node can't leave the scope of the loop.")
470 + linkName);
471
472 if(_finalizeNode)
473 if(isInMyDescendance(port.first->getNode())==_finalizeNode)
474 throw Exception(std::string("Illegal link within a parallel loop: \
475an output port of the finalize node can't be linked.")
476 + linkName);
477
478 if(port.first==&_splittedPort)
479 throw Exception(std::string("Illegal link within a parallel loop: \
480the 'evalSamples' port must be linked within the scope of the loop.")
481 + linkName);
482}
Node * isInMyDescendance(Node *nodeToTest) const
Returns the parent of a node that is the direct child of this node.
std::string getName() const
Definition: DataPort.hxx:55

References _finalizeNode, _initNode, _splittedPort, YACS::ENGINE::DataPort::getName(), and YACS::ENGINE::ComposedNode::isInMyDescendance().

◆ checkBasicConsistency()

void DynParaLoop::checkBasicConsistency ( ) const
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::OptimizerLoop.

Definition at line 579 of file DynParaLoop.cxx.

580{
581 DEBTRACE("DynParaLoop::checkBasicConsistency");
583 if(!_node)
584 throw Exception("For a dynamic loop, internal node is mandatory");
585}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
virtual void checkBasicConsistency() const

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

Referenced by YACS::ENGINE::OptimizerLoop::checkBasicConsistency().

◆ checkCFLinks()

void DynParaLoop::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.

Reimplemented in YACS::ENGINE::OptimizerLoop.

Definition at line 484 of file DynParaLoop.cxx.

485{
486 const char what[]="DynParaLoop::checkCFLinks : internal error.";
487 //First dealing checkCFLinks forwarding...
488 if(isInMyDescendance(end->getNode())==0)//no chance that _splittedPort is in starts due to buildDelegate.
489 solveObviousOrDelegateCFLinks(starts,end,alreadyFed,direction,info);
490 else
491 {//no forwarding here.
492 if(starts.size()!=1)
493 throw Exception(what);
494 //ASSERT(direction) : see DynParaLoop::checkControlDependancy only 'fw' filled.
495 if(alreadyFed==FREE_ST)
496 alreadyFed=FED_ST;
497 else if(alreadyFed==FED_ST)
498 {//Shame ! splittedPort fills a port already fed...
499 info.pushInfoLink(*(starts.begin()),end,I_USELESS);
500 }
501 }
502}
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
void pushInfoLink(OutPort *semStart, InPort *end, InfoReason reason)
Definition: LinkInfo.cxx:71
Node * getNode() const
Definition: Port.hxx:46

References 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().

Referenced by YACS::ENGINE::OptimizerLoop::checkCFLinks().

◆ checkConsistencyAndSetNode()

Node * DynParaLoop::checkConsistencyAndSetNode ( Node *&  nodeToReplace,
Node DISOWNnode 
)
protected

This method is used to factorize methods edSetNode, edSetInitNode and edSetFinalizeNode.

Definition at line 80 of file DynParaLoop.cxx.

81{
82 if (node == NULL || nodeToReplace == node)
83 return 0;
84 if (node->_father)
85 throw Exception(string("Can't set node: node ") + node->getName() + " is not orphan.");
86 if (_node && _node != nodeToReplace && _node->getName() == node->getName())
87 throw Exception(string("Can't set node: node ") + node->getName() +
88 " has the same name than exec node already in " + _name + ".");
89 if (_initNode && _initNode != nodeToReplace && _initNode->getName() == node->getName())
90 throw Exception(string("Can't set node: node ") + node->getName() +
91 " has the same name than init node already in " + _name + ".");
92 if (_finalizeNode && _finalizeNode != nodeToReplace && _finalizeNode->getName() == node->getName())
93 throw Exception(string("Can't set node: node ") + node->getName() +
94 " has the same name than finalize node already in " + _name + ".");
96 ComposedNode::edRemoveChild(nodeToReplace);
97 Node * ret = nodeToReplace;
98 nodeToReplace = node;
99 nodeToReplace->_father = this;
100 // set _modified flag so that edUpdateState can refresh state
101 modified();
102 return ret;
103}
void checkNoCrossHierachyWith(Node *node) const
virtual void edRemoveChild(Node *node)
Remove a child node.
Base class for all nodes.
Definition: Node.hxx:70
std::string _name
Definition: Node.hxx:89
ComposedNode * _father
Definition: Node.hxx:90
const std::string & getName() const
Definition: Node.hxx:125
virtual void modified()
Sets Node in modified state and its father if it exists.
Definition: Node.cxx:805

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

Referenced by edSetFinalizeNode(), edSetInitNode(), and edSetNode().

◆ checkControlDependancy()

void DynParaLoop::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
Parameters
start: start port
end: end port
crossindicates if start -> end link is a DS link behind.
fwout parameter.
fwCrossout parameter storing links where a cross has been detected.
bwout parameter where backward links are stored.
info: collected information

Implements YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::OptimizerLoop.

Definition at line 513 of file DynParaLoop.cxx.

518{
519 fw[(ComposedNode *)this].push_back(start);
520}
Base class for all composed nodes.

Referenced by YACS::ENGINE::OptimizerLoop::checkControlDependancy().

◆ checkLinkPossibility()

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

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 522 of file DynParaLoop.cxx.

524{
525 ComposedNode::checkLinkPossibility(start, pointsOfViewStart, end, pointsOfViewEnd);
526 Node * startNode = isInMyDescendance(start->getNode());
527 Node * endNode = isInMyDescendance(end->getNode());
528 std::string linkName("(");
529 linkName += start->getName()+" to "+end->getName()+")";
530
531 if(start == &_splittedPort && endNode != _node)
532 throw Exception(std::string("Illegal link within a parallel loop: \
533the 'evalSamples' port can only be connected to the working node of the loop.")
534 + linkName);
535
536 if(_finalizeNode && _finalizeNode == startNode)
537 throw Exception(std::string("Illegal link within a parallel loop: \
538the finalize node can't be the origin of a link.")
539 + linkName);
540
541 if(_initNode && _node == startNode && _initNode == endNode)
542 throw Exception(std::string("Illegal link within a parallel loop: \
543can't make a link from the working node to the init node.")
544 + linkName);
545
546 if(_finalizeNode && _node == startNode && _finalizeNode == endNode)
547 throw Exception(std::string("Illegal link within a parallel loop: \
548can't make a link from the working node to the finalize node.")
549 + linkName);
550}
virtual void checkLinkPossibility(OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)

References _finalizeNode, _initNode, _node, _splittedPort, YACS::ENGINE::ComposedNode::checkLinkPossibility(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::Port::getNode(), and YACS::ENGINE::ComposedNode::isInMyDescendance().

Referenced by YACS::ENGINE::ForEachLoopGen::checkLinkPossibility(), and YACS::ENGINE::OptimizerLoop::checkLinkPossibility().

◆ cleanDynGraph()

void DynParaLoop::cleanDynGraph ( )
virtual

Reimplemented in YACS::ENGINE::ForEachLoopGen.

Definition at line 333 of file DynParaLoop.cxx.

334{
335 vector<Node *>::iterator iter;
336 for(iter=_execNodes.begin() ; iter!=_execNodes.end() ; iter++)
337 delete *iter;
338 _execNodes.clear();
339 for(iter=_execInitNodes.begin() ; iter!=_execInitNodes.end() ; iter++)
340 delete *iter;
341 _execInitNodes.clear();
342 for(iter=_execFinalizeNodes.begin() ; iter!=_execFinalizeNodes.end() ; iter++)
343 delete *iter;
344 _execFinalizeNodes.clear();
345}
std::vector< Node * > _execNodes
Definition: DynParaLoop.hxx:58
std::vector< Node * > _execFinalizeNodes
Definition: DynParaLoop.hxx:60
std::vector< Node * > _execInitNodes
Definition: DynParaLoop.hxx:59

References _execFinalizeNodes, _execInitNodes, and _execNodes.

Referenced by YACS::ENGINE::ForEachLoopGen::cleanDynGraph(), YACS::ENGINE::OptimizerLoop::init(), and YACS::ENGINE::OptimizerLoop::~OptimizerLoop().

◆ cloneAndPlaceNodesCoherently()

vector< Node * > DynParaLoop::cloneAndPlaceNodesCoherently ( const std::vector< Node * > &  origNodes)
protected

Clone nodes and make their placement consistent with the placement of the original ones.

For instance, if two original nodes are placed on a component comp1 in a container cont1 and a third one is placed on a component comp2 in the container cont1, the clones of the two first nodes will be placed on a component comp3 in a container cont2 and the third clone will be placed on a component comp4 in the container cont2.

Definition at line 744 of file DynParaLoop.cxx.

745{
746 DEBTRACE("Begin cloneAndPlaceNodesCoherently")
747 vector<Node *> clones;
748 DeploymentTree treeToDup;
749 vector<list<ElementaryNode *> > origElemNodeList;
750 for (int i=0 ; i<origNodes.size() ; i++)
751 {
752 DEBTRACE("Cloning node " << i)
753 if (origNodes[i] == NULL)
754 {
755 DEBTRACE("Cloning node " << i << ", NULL" )
756 clones.push_back(NULL);
757 origElemNodeList.push_back(list<ElementaryNode *>());
758 }
759 else
760 {
761 DEBTRACE("Cloning node " << i << "," << origNodes[i]->getName())
762 clones.push_back(origNodes[i]->simpleClone(this, false));
763 list<ElementaryNode *> tasks = origNodes[i]->getRecursiveConstituents();
764 origElemNodeList.push_back(tasks);
765 for (list< ElementaryNode *>::iterator iter=tasks.begin() ; iter!=tasks.end() ; iter++)
766 treeToDup.appendTask(*iter, (*iter)->getDynClonerIfExists(this));
767 }
768 }
769
770 // Build the links between clones.
771 // Only the links starting from initNode are possible.
772 if(_initNode)
773 {
774 std::vector< std::pair<OutPort *, InPort *> > outLinks = _initNode->getSetOfLinksLeavingCurrentScope();
775 std::vector< std::pair<OutPort *, InPort *> >::const_iterator it;
776 for(it=outLinks.begin(); it!=outLinks.end(); it++)
777 {
778 OutPort *startPort = it->first;
779 InPort *endPort = it->second;
780 Node* destNode = isInMyDescendance(endPort->getNode());
781 if(destNode == _node)
782 edAddLink(clones[0]->getOutPort(startPort->getName()),
783 clones[1]->getInPort(endPort->getName()));
784 if(destNode == _finalizeNode)
785 edAddLink(clones[0]->getOutPort(startPort->getName()),
786 clones[2]->getInPort(endPort->getName()));
787 }
788 }
789
790 DEBTRACE("Placing nodes...")
791 vector<Container *> conts=treeToDup.getAllContainers();
792
793 //iterate on all containers
794 for(vector<Container *>::iterator iterCt=conts.begin();iterCt!=conts.end();iterCt++)
795 {
796 DEBTRACE("Container " << ((*iterCt)?(*iterCt)->getName():"NULL"))
797 vector<ComponentInstance *> comps=treeToDup.getComponentsLinkedToContainer(*iterCt);
798 Container *contCloned=0;
799 if((*iterCt))
800 contCloned=(*iterCt)->clone();
801
802 //iterate on all component instances linked to the container
803 for(vector<ComponentInstance *>::iterator iterCp=comps.begin();iterCp!=comps.end();iterCp++)
804 {
805 DEBTRACE("Component " << (*iterCp)->getCompoName())
806 vector<Task *> tasks=treeToDup.getTasksLinkedToComponent(*iterCp);
807 ComponentInstance *curCloned=(*iterCp)->clone();
808 DEBTRACE("Assign container " << (*iterCp)->getCompoName())
809 curCloned->setContainer(contCloned);
810 for(vector<Task *>::iterator iterT=tasks.begin();iterT!=tasks.end();iterT++)
811 {
812 DEBTRACE("Task " << ((ElementaryNode *)(*iterT))->getName())
813 int i = 0;
814 ElementaryNode * origElemNode = NULL;
815 for (i=0 ; i<origNodes.size() ; i++)
816 if (origNodes[i] != NULL)
817 {
818 DEBTRACE("Looking in original node " << i)
819 list<ElementaryNode *>::iterator res=find(origElemNodeList[i].begin(),
820 origElemNodeList[i].end(),
821 (ElementaryNode *)(*iterT));
822 if (res != origElemNodeList[i].end()) {
823 origElemNode = *res;
824 break;
825 }
826 }
827
828 YASSERT(origElemNode != NULL)
829 DEBTRACE("Found task in node " << i)
830 ServiceNode * nodeC = NULL;
831 if (origNodes[i] == origElemNode)
832 nodeC = (ServiceNode *)clones[i];
833 else
834 {
835 string childName = ((ComposedNode *)origNodes[i])->getChildName(origElemNode);
836 nodeC = (ServiceNode *)clones[i]->getChildByName(childName);
837 }
838 DEBTRACE("Assign component: " << (*iterCp)->getCompoName() << "," << nodeC->getName())
839 nodeC->setComponent(curCloned);
840 }
841 curCloned->decrRef();
842 }
843
844 // iterate on all tasks linked to the container
845 vector<Task *> tasks=treeToDup.getTasksLinkedToContainer(*iterCt);
846 for(vector<Task *>::iterator iterT=tasks.begin();iterT!=tasks.end();iterT++)
847 {
848 DEBTRACE("Task " << ((ElementaryNode *)(*iterT))->getName())
849 int i = 0;
850 ElementaryNode * origElemNode = NULL;
851 for (i=0 ; i<origNodes.size() ; i++)
852 if (origNodes[i] != NULL)
853 {
854 DEBTRACE("Looking in original node " << i)
855 list<ElementaryNode *>::iterator res=find(origElemNodeList[i].begin(),
856 origElemNodeList[i].end(),
857 (ElementaryNode *)(*iterT));
858 if (res != origElemNodeList[i].end())
859 {
860 origElemNode = *res;
861 break;
862 }
863 }
864 YASSERT(origElemNode != NULL)
865 DEBTRACE("Found task in node " << i)
866 InlineFuncNode * nodeC = NULL;
867 if (origNodes[i] == origElemNode)
868 {
869 nodeC = (InlineFuncNode *)clones[i];
870 }
871 else
872 {
873 string childName = ((ComposedNode *)origNodes[i])->getChildName(origElemNode);
874 nodeC = (InlineFuncNode *)clones[i]->getChildByName(childName);
875 }
876 DEBTRACE("Assign container " << nodeC->getName() << "," << contCloned->getName())
877 nodeC->setContainer(contCloned);
878 }
879
880 // ended with current container
881 if(contCloned)
882 contCloned->decrRef();
883 }
884
886 return clones;
887}
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
Definition: YacsTrace.hxx:59
Base class for all component instances.
Node * getChildByName(const std::string &name) const
std::list< ElementaryNode * > getRecursiveConstituents() const
std::string getName() const
std::vector< Node * > cloneAndPlaceNodesCoherently(const std::vector< Node * > &origNodes)
Clone nodes and make their placement consistent with the placement of the original ones.
OutPort * getOutPort(const std::string &name) const
Base class for all calculation nodes.
Class for calculation node (function) inlined (and executed) in the schema.
Definition: InlineNode.hxx:93
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope() const =0
virtual Node * simpleClone(ComposedNode *father, bool editionOnly=true) const =0
Class for calculation node associated with a component service.
Definition: ServiceNode.hxx:35

References _finalizeNode, _initNode, _node, YACS::ENGINE::DeploymentTree::appendTask(), YACS::ENGINE::ComponentInstance::clone(), YACS::ENGINE::Container::clone(), DEBTRACE, YACS::ENGINE::RefCounter::decrRef(), YACS::ENGINE::ComposedNode::edAddLink(), YACS::ENGINE::DeploymentTree::getAllContainers(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::ENGINE::DeploymentTree::getComponentsLinkedToContainer(), YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::Container::getName(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Port::getNode(), getOutPort(), YACS::ENGINE::Node::getSetOfLinksLeavingCurrentScope(), YACS::ENGINE::DeploymentTree::getTasksLinkedToComponent(), YACS::ENGINE::DeploymentTree::getTasksLinkedToContainer(), yacsorb.CORBAEngineTest::i, YACS::ENGINE::ComposedNode::isInMyDescendance(), YACS::ENGINE::ServiceNode::setComponent(), YACS::ENGINE::ComponentInstance::setContainer(), YACS::ENGINE::InlineNode::setContainer(), YACS::ENGINE::Node::simpleClone(), and YASSERT.

Referenced by YACS::ENGINE::ForEachLoopGen::exUpdateState(), and YACS::ENGINE::OptimizerLoop::exUpdateState().

◆ edAddChild()

bool DynParaLoop::edAddChild ( Node DISOWNnode)
virtual

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 257 of file DynParaLoop.cxx.

258{
259 return edSetNode(DISOWNnode);
260}
Node * edSetNode(Node *DISOWNnode)
Definition: DynParaLoop.cxx:74

References edSetNode().

◆ edAddDFLink()

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

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

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

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

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 141 of file DynParaLoop.cxx.

142{
143 return edAddLink(start,end);
144}

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

◆ edGetDirectDescendants()

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

Implements YACS::ENGINE::ComposedNode.

Definition at line 262 of file DynParaLoop.cxx.

263{
264 list<Node *> ret;
265 if(_node)
266 ret.push_back(_node);
267 if(_initNode)
268 ret.push_back(_initNode);
269 if(_finalizeNode)
270 ret.push_back(_finalizeNode);
271 return ret;
272}

References _finalizeNode, _initNode, and _node.

Referenced by getErrorReport(), and YACS::ENGINE::ForEachLoopGen::getProgressWeight().

◆ edGetNbOfBranchesPort()

◆ edGetSamplePort()

◆ edRemoveChild()

void DynParaLoop::edRemoveChild ( Node node)
virtual

Remove a child node.

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 245 of file DynParaLoop.cxx.

246{
248 if(node==_node)
249 _node=0;
250 if(node==_initNode)
251 _initNode=0;
252 if(node==_finalizeNode)
254 modified();
255}

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

Referenced by YACS::HMI::SubjectForEachLoop::clean().

◆ edRemoveFinalizeNode()

Node * DynParaLoop::edRemoveFinalizeNode ( )

Definition at line 240 of file DynParaLoop.cxx.

241{
243}
Node * removeNode(Node *&nodeToRemove)
This method is used to factorize methods edRemoveNode, edRemoveInitNode and edRemoveFinalizeNode.

References _finalizeNode, and removeNode().

◆ edRemoveInitNode()

Node * DynParaLoop::edRemoveInitNode ( )

Definition at line 235 of file DynParaLoop.cxx.

236{
237 return removeNode(_initNode);
238}

References _initNode, and removeNode().

◆ edRemoveNode()

Node * DynParaLoop::edRemoveNode ( )

Definition at line 218 of file DynParaLoop.cxx.

219{
220 return removeNode(_node);
221}

References _node, and removeNode().

◆ edSetFinalizeNode()

Node * DynParaLoop::edSetFinalizeNode ( Node DISOWNnode)

Definition at line 127 of file DynParaLoop.cxx.

128{
130}
Node * checkConsistencyAndSetNode(Node *&nodeToReplace, Node *DISOWNnode)
This method is used to factorize methods edSetNode, edSetInitNode and edSetFinalizeNode.
Definition: DynParaLoop.cxx:80

References _finalizeNode, and checkConsistencyAndSetNode().

Referenced by YACS::dynparalooptypeParser< T >::finalizenode().

◆ edSetInitNode()

Node * DynParaLoop::edSetInitNode ( Node DISOWNnode)

Definition at line 122 of file DynParaLoop.cxx.

123{
125}

References _initNode, and checkConsistencyAndSetNode().

Referenced by YACS::dynparalooptypeParser< T >::initnode().

◆ edSetNode()

Node * DynParaLoop::edSetNode ( Node DISOWNnode)

Definition at line 74 of file DynParaLoop.cxx.

75{
77}

References _node, and checkConsistencyAndSetNode().

Referenced by edAddChild().

◆ forceMultiplicity()

void DynParaLoop::forceMultiplicity ( unsigned  value)
virtual

Implements YACS::ENGINE::Scheduler.

Definition at line 450 of file DynParaLoop.cxx.

451{
452 _nbOfBranches->forceMultiplicity(value);
453}

References _nbOfBranches.

◆ forwardExecStateToOriginalBody()

void DynParaLoop::forwardExecStateToOriginalBody ( Node execNode)
protectedvirtual

Definition at line 663 of file DynParaLoop.cxx.

664{
665 unsigned int id;
666 Node * origNode = NULL;
667 switch (getIdentityOfNotifyerNode(execNode,id))
668 {
669 case INIT_NODE:
670 {
671 origNode = _initNode;
672 break;
673 }
674 case WORK_NODE:
675 {
676 origNode = _node;
677 break;
678 }
679 case FINALIZE_NODE:
680 {
681 origNode = _finalizeNode;
682 break;
683 }
684 default:
685 YASSERT(false)
686 }
687
688 YASSERT(origNode != NULL)
689 origNode->setState(execNode->getState());
690 origNode->setErrorDetails(execNode->getErrorDetails());
691
692 ComposedNode* compNode = dynamic_cast<ComposedNode*>(origNode);
693 ComposedNode* compNodeExe = dynamic_cast<ComposedNode*>(execNode);
694 if (compNode && compNodeExe)
695 {
696 list<Node *> aChldn = compNodeExe->getAllRecursiveConstituents();
697 list<Node *>::iterator iter=aChldn.begin();
698 for(;iter!=aChldn.end();iter++)
699 {
700 Node* node=compNode->getChildByName(compNodeExe->getChildName(*iter));
701 node->setState((*iter)->getState());
702 node->setErrorDetails((*iter)->getErrorDetails());
703 }
704 }
705}
std::string getChildName(const Node *node) const
virtual std::list< Node * > getAllRecursiveConstituents()
Idem getAllRecursiveNodes, but this node is NOT included.
TypeOfNode getIdentityOfNotifyerNode(const Node *node, unsigned &id)
virtual void setErrorDetails(const std::string &error)
Definition: Node.hxx:191
void setState(YACS::StatesForNode theState)
Sets the given state for node.
Definition: Node.cxx:652
virtual std::string getErrorDetails() const
Definition: Node.hxx:190
virtual YACS::StatesForNode getState() const
Definition: Node.hxx:118

References _finalizeNode, _initNode, _node, FINALIZE_NODE, YACS::ENGINE::ComposedNode::getAllRecursiveConstituents(), YACS::ENGINE::ComposedNode::getChildByName(), YACS::ENGINE::ComposedNode::getChildName(), YACS::ENGINE::Node::getErrorDetails(), getIdentityOfNotifyerNode(), YACS::ENGINE::Node::getState(), INIT_NODE, YACS::ENGINE::Node::setErrorDetails(), YACS::ENGINE::Node::setState(), WORK_NODE, and YASSERT.

Referenced by YACS::ENGINE::ForEachLoopGen::exUpdateState(), and updateStateOnFailedEventFrom().

◆ getBranchIDOfNode()

int DynParaLoop::getBranchIDOfNode ( Node node) const

DynParaLoop creates at runtime (exupdateState) clone of nodes. One clone per branch. This method returns the id of the branch given the node node. If node is not a dynamically created node in this -1 is returned.

Definition at line 161 of file DynParaLoop.cxx.

162{
163 if(_node)
164 {
165 for(std::vector<Node *>::const_iterator it=_execNodes.begin();it!=_execNodes.end();it++)
166 if(node==*it)
167 return std::distance(_execNodes.begin(),it);
168 }
169 if(_finalizeNode)
170 {
171 for(std::vector<Node *>::const_iterator it=_execFinalizeNodes.begin();it!=_execFinalizeNodes.end();it++)
172 if(node==*it)
173 return std::distance(_execFinalizeNodes.begin(),it);
174 }
175 if(_initNode)
176 {
177 for(std::vector<Node *>::const_iterator it=_execInitNodes.begin();it!=_execInitNodes.end();it++)
178 if(node==*it)
179 return std::distance(_execInitNodes.begin(),it);
180 }
181 return -1;
182}
def distance(node, new_node)
Definition: graph.py:275

References _execFinalizeNodes, _execInitNodes, _execNodes, _finalizeNode, _initNode, _node, and gui.graph::distance().

Referenced by YACS::ENGINE::Node::getDPLScopeInfo().

◆ getChildByNameExec()

Node * DynParaLoop::getChildByNameExec ( const std::string &  name,
unsigned  id 
) const

Definition at line 319 of file DynParaLoop.cxx.

320{
322 throw Exception("ForEachLoop::getChildByNameExec : invalid id - too large compared with dynamically created branches.");
323 if (_node && name == _node->getName())
324 return _execNodes[id];
325 if (_initNode && name == _initNode->getName())
326 return _execInitNodes[id];
327 if (_finalizeNode && name == _finalizeNode->getName())
328 return _execFinalizeNodes[id];
329 std::string what("node "); what+= name ; what+=" is not a child of DynParaLoop node "; what += getName();
330 throw Exception(what);
331}
unsigned getNumberOfBranchesCreatedDyn() const

References _execFinalizeNodes, _execInitNodes, _execNodes, _finalizeNode, _initNode, _node, YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::Node::getName(), and getNumberOfBranchesCreatedDyn().

◆ getChildByShortName()

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

Implements YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::ForEachLoopGen.

Definition at line 307 of file DynParaLoop.cxx.

308{
309 if (_node && name == _node->getName())
310 return _node;
311 if (_initNode && name == _initNode->getName())
312 return _initNode;
313 if (_finalizeNode && name == _finalizeNode->getName())
314 return _finalizeNode;
315 std::string what("node "); what+= name ; what+=" is not a child of DynParaLoop node "; what += getName();
316 throw Exception(what);
317}

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

Referenced by YACS::ENGINE::ForEachLoopGen::getChildByShortName().

◆ getDynInputPortByAbsName()

InputPort * DynParaLoop::getDynInputPortByAbsName ( int  branchNb,
const std::string &  name,
bool  initNodeAdmitted 
)
protected
Note
: For a given name 'name' of port in absolute form from this, returns the corresponding InputPort instance of the port for the branch # 'branchNb'. The port can be part of _node or _initNode if it exists (if 'initNodeAdmitted' is true). WARNING : no check performed on 'branchNb' value to see if it is compatible with size of '_execNodes'. This method is called to dispatch value on each InputPort linked to this->._splitterNode._splittedPort

Definition at line 559 of file DynParaLoop.cxx.

560{
561 string portName, nodeName;
562 splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,true);
563 Node *staticChild = getChildByName(nodeName);
564 Node *desc=isInMyDescendance(staticChild);
565 if(desc==_node)
566 {
567 splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,false);
568 return _execNodes[branchNb]->getInputPort(portName);
569 }
570 else if(desc==_initNode)
571 if(initNodeAdmitted)
572 {
573 splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,false);
574 return _execInitNodes[branchNb]->getInputPort(portName);
575 }
576 return 0;
577}
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 _execInitNodes, _execNodes, _initNode, _node, YACS::ENGINE::ComposedNode::getChildByName(), YACS::ENGINE::ComposedNode::isInMyDescendance(), YACS::ENGINE::Node::SEP_CHAR_IN_PORT, and YACS::ENGINE::ComposedNode::splitNamesBySep().

Referenced by prepareInputsFromOutOfScope(), and putValueOnBranch().

◆ getErrorReport()

std::string DynParaLoop::getErrorReport ( )
virtual

returns a string that contains an error report if the node is in error

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 587 of file DynParaLoop.cxx.

588{
589 DEBTRACE("DynParaLoop::getErrorReport: " << getName() << " " << _state);
590 YACS::StatesForNode effectiveState=getEffectiveState();
591
592 if(effectiveState != YACS::INVALID && effectiveState != YACS::ERROR && effectiveState != YACS::FAILED)
593 return "";
594
595 std::string report="<error node= " + getName();
596 switch(effectiveState)
597 {
598 case YACS::INVALID:
599 report=report+" state= INVALID";
600 break;
601 case YACS::ERROR:
602 report=report+" state= ERROR";
603 break;
604 case YACS::FAILED:
605 report=report+" state= FAILED";
606 break;
607 default:
608 break;
609 }
610 report=report + ">\n" ;
611 if(_errorDetails != "")
612 report=report+_errorDetails+"\n";
613
614 if(_execNodes.empty())
615 {
616 // edition node
617 list<Node *> constituents=edGetDirectDescendants();
618 for(list<Node *>::iterator iter=constituents.begin(); iter!=constituents.end(); iter++)
619 {
620 std::string rep=(*iter)->getErrorReport();
621 if(rep != "")
622 {
623 report=report+rep+"\n";
624 }
625 }
626 }
627 else
628 {
629 // execution nodes
630 for(vector<Node *>::iterator iter=_execInitNodes.begin();iter!=_execInitNodes.end();iter++)
631 {
632 std::string rep=(*iter)->getErrorReport();
633 if(rep != "")
634 {
635 report=report+rep+"\n";
636 }
637 }
638 for(vector<Node *>::iterator iter=_execNodes.begin();iter!=_execNodes.end();iter++)
639 {
640 if(*iter)
641 {
642 std::string rep=(*iter)->getErrorReport();
643 if(rep != "")
644 {
645 report=report+rep+"\n";
646 }
647 }
648 }
649 for(vector<Node *>::iterator iter=_execFinalizeNodes.begin();iter!=_execFinalizeNodes.end();iter++)
650 {
651 std::string rep=(*iter)->getErrorReport();
652 if(rep != "")
653 {
654 report=report+rep+"\n";
655 }
656 }
657 }
658
659 report=report+"</error>";
660 return report;
661}
std::list< Node * > edGetDirectDescendants() const
std::string _errorDetails
Definition: Node.hxx:93
virtual YACS::StatesForNode getEffectiveState() const
Return the node state in the context of its father.
Definition: Node.cxx:538
YACS::StatesForNode _state
Definition: Node.hxx:91
StatesForNode
Definition: define.hxx:34
@ INVALID
Definition: define.hxx:36
@ FAILED
Definition: define.hxx:51
@ ERROR
Definition: define.hxx:52

References YACS::ENGINE::Node::_errorDetails, _execFinalizeNodes, _execInitNodes, _execNodes, YACS::ENGINE::Node::_state, DEBTRACE, edGetDirectDescendants(), YACS::ERROR, YACS::FAILED, YACS::ENGINE::Node::getEffectiveState(), YACS::ENGINE::ComposedNode::getName(), and YACS::INVALID.

◆ getExecNode()

Node * DynParaLoop::getExecNode ( )

◆ getFinalizeNode()

Node * DynParaLoop::getFinalizeNode ( )

◆ getIdentityOfNotifyerNode()

DynParaLoop::TypeOfNode DynParaLoop::getIdentityOfNotifyerNode ( const Node node,
unsigned &  id 
)
protected

Definition at line 413 of file DynParaLoop.cxx.

414{
415 vector<Node *>::iterator iter;
416 id=0;
417 for (iter=_execNodes.begin() ; iter!=_execNodes.end() ; iter++,id++)
418 if (*iter==node)
419 return WORK_NODE;
420 id=0;
421 for (iter=_execInitNodes.begin() ; iter!=_execInitNodes.end() ; iter++,id++)
422 if (*iter==node)
423 return INIT_NODE;
424 id=0;
425 for (iter=_execFinalizeNodes.begin() ; iter!=_execFinalizeNodes.end() ; iter++,id++)
426 if (*iter==node)
427 return FINALIZE_NODE;
428 throw Exception("DynParaLoop::getIdentityOfNotifyerNode: unrecognized node !");
429}

References _execFinalizeNodes, _execInitNodes, _execNodes, FINALIZE_NODE, INIT_NODE, and WORK_NODE.

Referenced by forwardExecStateToOriginalBody(), updateStateOnFailedEventFrom(), YACS::ENGINE::ForEachLoopGen::updateStateOnFailedEventFrom(), YACS::ENGINE::ForEachLoopGen::updateStateOnFinishedEventFrom(), and YACS::ENGINE::OptimizerLoop::updateStateOnFinishedEventFrom().

◆ getInitNode()

Node * DynParaLoop::getInitNode ( )

◆ getInputPort()

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

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 283 of file DynParaLoop.cxx.

284{
285 if(_nbOfBranches->isMyName(name))
286 return _nbOfBranches->getPort();
287 return ComposedNode::getInputPort(name);
288}
InputPort * getInputPort(const std::string &name) const
Get an input port given its name.

References _nbOfBranches, and YACS::ENGINE::ComposedNode::getInputPort().

Referenced by YACS::ENGINE::ForEachLoopGen::getInputPort(), and YACS::ENGINE::OptimizerLoop::getInputPort().

◆ getLocalInputPorts()

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

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

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 290 of file DynParaLoop.cxx.

291{
292 list<InputPort *> ret=ComposedNode::getLocalInputPorts();
293 InputPort *port(_nbOfBranches->getPort());
294 if(port)
295 ret.push_back(port);
296 return ret;
297}
std::list< InputPort * > getLocalInputPorts() const
redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself
Base class for Input Ports.
Definition: InputPort.hxx:44

References _nbOfBranches, and YACS::ENGINE::ComposedNode::getLocalInputPorts().

Referenced by YACS::ENGINE::ForEachLoopGen::getLocalInputPorts(), YACS::ENGINE::OptimizerLoop::getLocalInputPorts(), and prepareInputsFromOutOfScope().

◆ getLocalOutputPorts()

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

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

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 191 of file DynParaLoop.cxx.

192{
193 list<OutputPort *> ret=ComposedNode::getLocalOutputPorts();
194 ret.push_back((OutputPort *)&_splittedPort);
195 return ret;
196}
std::list< OutputPort * > getLocalOutputPorts() const
redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself

References _splittedPort, and YACS::ENGINE::ComposedNode::getLocalOutputPorts().

Referenced by YACS::ENGINE::OptimizerLoop::getLocalOutputPorts().

◆ getMaxLevelOfParallelism()

int DynParaLoop::getMaxLevelOfParallelism ( ) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 909 of file DynParaLoop.cxx.

910{
911 return _nbOfBranches->getIntValue() * _node->getMaxLevelOfParallelism();
912}
virtual int getMaxLevelOfParallelism() const =0

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

◆ getNodes()

std::vector< Node * > YACS::ENGINE::DynParaLoop::getNodes ( ) const
inline

Definition at line 105 of file DynParaLoop.hxx.

105{ return _execNodes; } // need to use in GUI part for adding observers for clone nodes

◆ getNumberOfBranchesCreatedDyn()

unsigned DynParaLoop::getNumberOfBranchesCreatedDyn ( ) const

Definition at line 299 of file DynParaLoop.cxx.

300{
301 if(_execNodes.empty())
302 throw Exception("ForEachLoop::getNumberOfBranches : No branches created dynamically ! - ForEachLoop needs to run or to be runned to call getNumberOfBranches");
303 else
304 return _execNodes.size();
305}

References _execNodes.

Referenced by getChildByNameExec().

◆ getNumberOfEltsConsumed()

unsigned YACS::ENGINE::DynParaLoop::getNumberOfEltsConsumed ( ) const
inline

Definition at line 86 of file DynParaLoop.hxx.

86{ return _nbOfEltConsumed; }

◆ getNumberOfInputPorts()

int DynParaLoop::getNumberOfInputPorts ( ) const
virtual

◆ getNumberOfOutputPorts()

int DynParaLoop::getNumberOfOutputPorts ( ) const
virtual

◆ getOutPort()

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

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 198 of file DynParaLoop.cxx.

199{
201 return (OutPort *)&_splittedPort;
202 return ComposedNode::getOutPort(name);
203}
OutPort * getOutPort(const std::string &name) const
static const char OLD_NAME_OF_SPLITTED_SEQ_OUT[]
Definition: DynParaLoop.hxx:68

References _splittedPort, YACS::ENGINE::ComposedNode::getOutPort(), NAME_OF_SPLITTED_SEQ_OUT, and OLD_NAME_OF_SPLITTED_SEQ_OUT.

Referenced by cloneAndPlaceNodesCoherently(), YACS::ENGINE::ForEachLoopGen::getOutPort(), and YACS::ENGINE::OptimizerLoop::getOutPort().

◆ getOutputPort()

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

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 206 of file DynParaLoop.cxx.

207{
209 return (OutputPort *)&_splittedPort;
210 return ComposedNode::getOutputPort(name);
211}
OutputPort * getOutputPort(const std::string &name) const
Get an output port given its name.

References _splittedPort, YACS::ENGINE::ComposedNode::getOutputPort(), NAME_OF_SPLITTED_SEQ_OUT, and OLD_NAME_OF_SPLITTED_SEQ_OUT.

Referenced by YACS::ENGINE::ForEachLoopGen::getOutputPort(), and YACS::ENGINE::OptimizerLoop::getOutputPort().

◆ getSetOfInputPort()

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

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 274 of file DynParaLoop.cxx.

275{
276 list<InputPort *> ret=ComposedNode::getSetOfInputPort();
277 InputPort *port(_nbOfBranches->getPort());
278 if(port)
279 ret.push_back(port);
280 return ret;
281}
std::list< InputPort * > getSetOfInputPort() const

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

Referenced by YACS::ENGINE::ForEachLoopGen::getSetOfInputPort(), and YACS::ENGINE::OptimizerLoop::getSetOfInputPort().

◆ getSetOfOutputPort()

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

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::OptimizerLoop.

Definition at line 184 of file DynParaLoop.cxx.

185{
186 list<OutputPort *> ret=ComposedNode::getSetOfOutputPort();
187 ret.push_back((OutputPort *)&_splittedPort);
188 return ret;
189}
std::list< OutputPort * > getSetOfOutputPort() const

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

Referenced by YACS::ENGINE::OptimizerLoop::getSetOfOutputPort().

◆ getWeight()

ComplexWeight * DynParaLoop::getWeight ( )

◆ getWeightRegardingDPL()

void YACS::ENGINE::DynParaLoop::getWeightRegardingDPL ( ComplexWeight weight)
inlinevirtual

Implements YACS::ENGINE::Node.

Definition at line 108 of file DynParaLoop.hxx.

108{weight->addWeight(getWeight());}
ComplexWeight * getWeight()

References YACS::ENGINE::ComplexWeight::addWeight().

◆ init()

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

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

Reimplemented from YACS::ENGINE::ComposedNode.

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 105 of file DynParaLoop.cxx.

106{
107 ComposedNode::init(start);
108 if(!_node)
109 {
110 string what("DynParaLoop::init : no node specified for ForEachLoop with name "); what +=_name;
111 throw Exception(what);
112 }
113 _node->init(start);
114 if (_initNode) _initNode->init(start);
115 if (_finalizeNode) _finalizeNode->init(start);
116 _nbOfBranches->exInit(start);
120}
void init(bool start=true)
virtual void init(bool start=true)
Definition: Node.cxx:102
virtual void exInit()
Definition: OutputPort.cxx:62

References _failedCounter, _finalizeNode, _initNode, YACS::ENGINE::Node::_name, _nbOfBranches, _nbOfEltConsumed, _node, _splittedPort, YACS::ENGINE::OutputPort::exInit(), YACS::ENGINE::ComposedNode::init(), and YACS::ENGINE::Node::init().

Referenced by YACS::ENGINE::ForEachLoopGen::init(), and YACS::ENGINE::OptimizerLoop::init().

◆ isLoop()

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

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 97 of file DynParaLoop.hxx.

97{ return true; }

◆ isMultiplicitySpecified()

bool DynParaLoop::isMultiplicitySpecified ( unsigned &  value) const
virtual

Implements YACS::ENGINE::Scheduler.

Definition at line 445 of file DynParaLoop.cxx.

446{
447 return _nbOfBranches->isMultiplicitySpecified(value);
448}

References _nbOfBranches.

◆ isPlacementPredictableB4Run()

bool DynParaLoop::isPlacementPredictableB4Run ( ) const
virtual

For the moment false is returned : impovement about it coming soon.

Implements YACS::ENGINE::ComposedNode.

Definition at line 213 of file DynParaLoop.cxx.

214{
215 return false;
216}

◆ partitionRegardingDPL()

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

Implements YACS::ENGINE::Node.

Definition at line 914 of file DynParaLoop.cxx.

915{
917 zeMap[this]=pd2;
918 if(_node)
919 _node->partitionRegardingDPL(pd,zeMap);
920}
virtual void partitionRegardingDPL(const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)=0
virtual PartDefinition * copy() const =0

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

◆ prepareInputsFromOutOfScope()

void DynParaLoop::prepareInputsFromOutOfScope ( int  branchNb)
protected

This method applies on newly cloned on exec nodes (_execNodes/_execInitNodes) the setting of input ports coming from outside of 'this'

Definition at line 351 of file DynParaLoop.cxx.

352{
353 set< InPort * > portsToSetVals=getAllInPortsComingFromOutsideOfCurrentScope();
354
355 // This tweak is to fix problems with nested dynamic loops where links are not cloned properly
356 list<InPort *> temp = getSetOfInPort();
357 for(list<InPort *>::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
358 {
359 if ((*iter2)->edSetOutPort().size() == 1 && *(*iter2)->edSetOutPort().begin() == NULL)
360 {
361 portsToSetVals.insert(*iter2);
362 }
363 }
364
365 // local input ports are not candidates for dynamically duplicated inport.
366 list<InputPort *> localPorts = getLocalInputPorts();
367 for(list<InputPort *>::iterator iter = localPorts.begin() ; iter != localPorts.end() ; iter++)
368 portsToSetVals.erase(*iter);
369 for(set< InPort * >::iterator iter=portsToSetVals.begin();iter!=portsToSetVals.end();iter++)
370 {
371 InputPort *curPortCasted=(InputPort *) *iter;//Cast granted by ForEachLoop::buildDelegateOf(InPort)
372 void *val=curPortCasted->get();
373 InputPort *portToSet=getDynInputPortByAbsName(branchNb,getInPortName(*iter),true);
374 if(portToSet)//portToSet==0 in case of portToSet==_splitterNode._dataPortToDispatch of ForEach
375 {
376 portToSet->put((const void *)val);
377 portToSet->edNotifyReferencedBy(nullptr,false);//This is to indicate that somewhere somebody deals with this inputport
378 //even if no direct physical link exists. This exclusively for _execNodes[branchNb]::init on the next turn of loop.
379 //false is put as 2nd parameter to tell to portToSet, do not touch to the data in case of squeezeMemory.
380 }
381 }
382}
std::string getInPortName(const InPort *) const
Get the input port name.
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope() const
List all input ports that are linked to out of scope ports.
std::list< InputPort * > getLocalInputPorts() const
redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself
InputPort * getDynInputPortByAbsName(int branchNb, const std::string &name, bool initNodeAdmitted)
virtual void edNotifyReferencedBy(OutPort *fromPort, bool isLoopProof=true)
Definition: InPort.cxx:93
virtual void put(const void *data)=0
virtual void * get() const =0
std::list< InPort * > getSetOfInPort() const
Definition: Node.cxx:289

References YACS::ENGINE::InPort::edNotifyReferencedBy(), YACS::ENGINE::InputPort::get(), YACS::ENGINE::ComposedNode::getAllInPortsComingFromOutsideOfCurrentScope(), getDynInputPortByAbsName(), YACS::ENGINE::ComposedNode::getInPortName(), getLocalInputPorts(), YACS::ENGINE::Node::getSetOfInPort(), and YACS::ENGINE::InputPort::put().

Referenced by YACS::ENGINE::ForEachLoopGen::exUpdateState(), and YACS::ENGINE::OptimizerLoop::exUpdateState().

◆ putValueOnBranch()

void DynParaLoop::putValueOnBranch ( Any val,
unsigned  branchId,
bool  first 
)
protected

Definition at line 384 of file DynParaLoop.cxx.

385{
386 bool isDispatched = false;
387 set<InPort *> inPrtLkdWthSplttdPrt=_splittedPort.edSetInPort();
388 for(set<InPort *>::iterator iter=inPrtLkdWthSplttdPrt.begin();iter!=inPrtLkdWthSplttdPrt.end();iter++)
389 {
390 std::string portNameOnCurPrt=getPortName(*iter);
391 InputPort *portOnGivenBranch=getDynInputPortByAbsName(branchId,portNameOnCurPrt,first);//Cast granted because impossible to have cross protocol with _splittedPort
392 //see OptimizerLoop::buildDelegateOf
393 if(portOnGivenBranch)
394 {
395 if(first)
396 portOnGivenBranch->edNotifyReferencedBy(0);
397 InputPort *traducer=getRuntime()->adapt(portOnGivenBranch,
399 traducer->put((const void *)val);
400 isDispatched = true;
401 if(traducer!=portOnGivenBranch)
402 delete traducer;
403 }
404 }
405 if ( isDispatched )
406 {
407 Any *tmp=val->clone();
409 tmp->decrRef();
410 }
411}
virtual void setValue(Any *data)
store the current dispatched value
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
virtual Any * clone() const =0
TypeCode * edGetType() const
Definition: DataPort.hxx:53
static const char RUNTIME_ENGINE_INTERACTION_IMPL_NAME[]
Definition: Runtime.hxx:135
virtual InputPort * adapt(InputPort *source, const std::string &impl, TypeCode *type, bool init=false)=0
YACSLIBENGINE_EXPORT Runtime * getRuntime()
Definition: Runtime.cxx:61

References _splittedPort, YACS::ENGINE::Runtime::adapt(), YACS::ENGINE::Any::clone(), YACS::ENGINE::RefCounter::decrRef(), YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::InPort::edNotifyReferencedBy(), YACS::ENGINE::OutputPort::edSetInPort(), getDynInputPortByAbsName(), YACS::ENGINE::ComposedNode::getPortName(), YACS::ENGINE::getRuntime(), YACS::ENGINE::InputPort::put(), YACS::ENGINE::Runtime::RUNTIME_ENGINE_INTERACTION_IMPL_NAME, and YACS::ENGINE::AnyOutputPort::setValue().

Referenced by YACS::ENGINE::OptimizerLoop::launchMaxOfSamples(), and YACS::ENGINE::SplitterNode::putSplittedValueOnRankTo().

◆ removeNode()

Node * DynParaLoop::removeNode ( Node *&  nodeToRemove)
protected

This method is used to factorize methods edRemoveNode, edRemoveInitNode and edRemoveFinalizeNode.

Definition at line 224 of file DynParaLoop.cxx.

225{
226 if (!nodeToRemove)
227 return NULL;
228 ComposedNode::edRemoveChild(nodeToRemove);
229 Node * ret = nodeToRemove;
230 nodeToRemove = NULL;
231 modified();
232 return ret;
233}

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

Referenced by edRemoveFinalizeNode(), edRemoveInitNode(), and edRemoveNode().

◆ setWeight()

void DynParaLoop::setWeight ( double  loopWeight)

Definition at line 431 of file DynParaLoop.cxx.

432{
433 if(loopWeight<=0.)
434 throw Exception("DynParaLoop::setWeight : invalid input value !");
435 _loopWeight=loopWeight;
436}

References _loopWeight.

Referenced by YACS::optimizerlooptypeParser< T >::postAttr().

◆ shutdown()

void DynParaLoop::shutdown ( int  level)
protectedvirtual

Stop all pending activities of the composed node.

This method should be called when a Proc is finished and must be deleted from the YACS server

Reimplemented from YACS::ENGINE::ComposedNode.

Definition at line 922 of file DynParaLoop.cxx.

923{
924 if(level==0)return;
925 if(!_node) return;
926
927 std::vector<Node *>::iterator iter;
928 for (iter=_execNodes.begin() ; iter!=_execNodes.end() ; iter++)
929 (*iter)->shutdown(level);
930 for (iter=_execInitNodes.begin() ; iter!=_execInitNodes.end() ; iter++)
931 (*iter)->shutdown(level);
932 for (iter=_execFinalizeNodes.begin() ; iter!=_execFinalizeNodes.end() ; iter++)
933 (*iter)->shutdown(level);
934}

References _execFinalizeNodes, _execInitNodes, _execNodes, and _node.

◆ updateStateOnFailedEventFrom()

YACS::Event DynParaLoop::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::ComposedNode.

Reimplemented in YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::OptimizerLoop.

Definition at line 714 of file DynParaLoop.cxx.

715{
716 DEBTRACE("DynParaLoop::updateStateOnFailedEventFrom " << node->getName());
719 unsigned int id;
720 switch (getIdentityOfNotifyerNode(node,id))
721 {
722 case INIT_NODE:
723 {
726 break;
727 }
728 case WORK_NODE:
729 {
731 break;
732 }
733 }
734 return YACS::ABORT;
735}
virtual void forwardExecStateToOriginalBody(Node *execNode)
@ ABORT
Definition: define.hxx:60

References _finalizeNode, _node, YACS::ABORT, DEBTRACE, YACS::FAILED, forwardExecStateToOriginalBody(), getIdentityOfNotifyerNode(), YACS::ENGINE::Node::getName(), INIT_NODE, YACS::ENGINE::Node::setState(), and WORK_NODE.

Referenced by YACS::ENGINE::ForEachLoopGen::updateStateOnFailedEventFrom(), and YACS::ENGINE::OptimizerLoop::updateStateOnFailedEventFrom().

Member Data Documentation

◆ _execFinalizeNodes

◆ _execIds

◆ _execInitNodes

◆ _execNodes

◆ _failedCounter

◆ _finalizeNode

◆ _initializingCounter

◆ _initNode

◆ _loopWeight

double YACS::ENGINE::DynParaLoop::_loopWeight
protected

Definition at line 65 of file DynParaLoop.hxx.

Referenced by getWeight(), and setWeight().

◆ _nbOfBranches

◆ _nbOfEltConsumed

◆ _node

◆ _splittedPort

◆ _unfinishedCounter

◆ _weight

ComplexWeight YACS::ENGINE::DynParaLoop::_weight
protected

Definition at line 64 of file DynParaLoop.hxx.

Referenced by DynParaLoop(), and getWeight().

◆ NAME_OF_SPLITTED_SEQ_OUT

const char DynParaLoop::NAME_OF_SPLITTED_SEQ_OUT = "evalSamples"
staticprotected

◆ OLD_NAME_OF_SPLITTED_SEQ_OUT

const char DynParaLoop::OLD_NAME_OF_SPLITTED_SEQ_OUT = "SmplPrt"
staticprotected

Definition at line 68 of file DynParaLoop.hxx.

Referenced by getOutPort(), and getOutputPort().


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