Version: 9.15.0
YACS::ENGINE::ComposedNode Class Referenceabstract

Base class for all composed nodes. More...

#include <ComposedNode.hxx>

Inheritance diagram for YACS::ENGINE::ComposedNode:
Collaboration diagram for YACS::ENGINE::ComposedNode:

Classes

struct  SortHierarc
 

Public Member Functions

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 ()
 
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
 
std::list< InPort * > getSetOfInPort () const
 
std::list< OutPort * > getSetOfOutPort () const
 
virtual std::set< InputPort * > edGetSetOfUnitializedInputPort () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
virtual bool edAreAllInputPortInitialized () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
InPortgetInPort (const std::string &name) const
 
InPropertyPortgetInPropertyPort () const
 
std::list< ComposedNode * > getAllAscendanceOf (ComposedNode *levelToStop=0) const
 
bool operator> (const Node &other) const
 
bool operator< (const Node &other) const
 
std::string getImplementation () const
 
DynParaLoopgetClosestDPLAmongAncestors () const
 
std::map< std::string, std::string > getProperties ()
 
std::map< std::string, std::string > getPropertyMap ()
 
virtual void setProperties (std::map< std::string, std::string > properties)
 
virtual ProcgetProc ()
 
virtual const ProcgetProc () const
 
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 getErrorDetails () const
 
virtual void setErrorDetails (const std::string &error)
 
virtual void modified ()
 Sets Node in modified state and its father if it exists. More...
 
virtual int isModified ()
 
virtual int isValid ()
 indicates if the node is valid (returns 1) or not (returns 0) More...
 
virtual std::string getContainerLog ()
 returns a string that contains the name of the container log file if it exists More...
 
virtual void ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
virtual void getCoupledNodes (std::set< Task * > &coupledNodes)
 
- Public Member Functions inherited from YACS::ENGINE::Scheduler
virtual void exUpdateState ()=0
 
virtual void selectRunnableTasks (std::vector< Task * > &tasks)=0
 
virtual bool isMultiplicitySpecified (unsigned &value) const =0
 
virtual void forceMultiplicity (unsigned value)=0
 
virtual ~Scheduler ()
 

Static Public Member Functions

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 SEP_CHAR_BTW_LEVEL [] ="."
 
- Static Public Attributes inherited from YACS::ENGINE::Node
static std::map< int, Node * > idMap
 

Protected Member Functions

 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 NodesimpleClone (ComposedNode *father, bool editionOnly=true) const =0
 
virtual void exForwardFailed ()
 
virtual void exForwardFinished ()
 

Static Protected Member Functions

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)
 

Static Protected Attributes

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
 

Friends

class Bloc
 
class Loop
 
class OutPort
 
class ElementaryNode
 

Additional Inherited Members

- Public Attributes inherited from YACS::ENGINE::Node
YACS::Colour _colour
 
- 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
 

Detailed Description

Base class for all composed nodes.

This is an abstract class that must be specialized.

Definition at line 42 of file ComposedNode.hxx.

Constructor & Destructor Documentation

◆ ComposedNode() [1/2]

ComposedNode::ComposedNode ( const std::string &  name)
protected

Definition at line 54 of file ComposedNode.cxx.

54  :Node(name)
55 {
56 }
Node(const std::string &name)
Definition: Node.cxx:69

◆ ComposedNode() [2/2]

ComposedNode::ComposedNode ( const ComposedNode other,
ComposedNode father 
)
protected

Definition at line 58 of file ComposedNode.cxx.

58  :Node(other,father)
59 {
60 }

◆ ~ComposedNode()

ComposedNode::~ComposedNode ( )
virtual

Definition at line 62 of file ComposedNode.cxx.

63 {
64 }

Member Function Documentation

◆ accept()

void ComposedNode::accept ( Visitor visitor)
virtual

Implements YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::WhileLoop, YACS::ENGINE::Switch, YACS::ENGINE::Proc, YACS::ENGINE::OptimizerLoop, YACS::ENGINE::Loop, YACS::ENGINE::ForLoop, YACS::ENGINE::ForEachLoopDyn, YACS::ENGINE::ForEachLoop, and YACS::ENGINE::DynParaLoop.

Definition at line 1495 of file ComposedNode.cxx.

1496 {
1497  list<Node *> constituents=edGetDirectDescendants();
1498  for(list<Node *>::iterator iter=constituents.begin(); iter!=constituents.end(); iter++)
1499  {
1500  (*iter)->accept(visitor);
1501  }
1502 }
virtual std::list< Node * > edGetDirectDescendants() const =0

References edGetDirectDescendants().

Referenced by YACS::ENGINE::Executor::saveState(), and YACS::ENGINE::VisitorSaveSalomeSchemaUnsafe().

◆ buildDelegateOf() [1/2]

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

Reimplemented in YACS::ENGINE::OptimizerLoop, YACS::ENGINE::Loop, and YACS::ENGINE::DynParaLoop.

Definition at line 1464 of file ComposedNode.cxx.

1465 {
1466 }

Referenced by edAddLink().

◆ buildDelegateOf() [2/2]

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

◆ checkBasicConsistency()

void ComposedNode::checkBasicConsistency ( ) const
virtual

Reimplemented in YACS::ENGINE::OptimizerLoop, YACS::ENGINE::Loop, and YACS::ENGINE::DynParaLoop.

Definition at line 1603 of file ComposedNode.cxx.

1604 {
1605  DEBTRACE("ComposedNode::checkBasicConsistency");
1606  std::list<InputPort *>::const_iterator iter;
1607  std::list<InputPort *> inports=getLocalInputPorts();
1608  for(iter=inports.begin();iter!=inports.end();iter++)
1609  (*iter)->checkBasicConsistency();
1610 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::list< InputPort * > getLocalInputPorts() const
redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself

References DEBTRACE, and getLocalInputPorts().

Referenced by YACS::ENGINE::DynParaLoop::checkBasicConsistency(), YACS::ENGINE::Loop::checkBasicConsistency(), and edUpdateState().

◆ checkCFLinks()

void ComposedNode::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 in YACS::ENGINE::Switch, YACS::ENGINE::OptimizerLoop, YACS::ENGINE::Loop, YACS::ENGINE::ForLoop, YACS::ENGINE::DynParaLoop, and YACS::ENGINE::Bloc.

Definition at line 807 of file ComposedNode.cxx.

808 {
809  static const char what[]="ComposedNode::checkCFLinks : Internal error occured - uncorrect hierarchy detected !";
810  Node *nodeEnd=isInMyDescendance(end->getNode());
811  if(!nodeEnd)
812  return solveObviousOrDelegateCFLinks(starts,end,alreadyFed,direction,info);
813  //This case is typically dedicated when direct son is ElementaryNode and self link is defined on this.
814  if(!dynamic_cast<ElementaryNode *>(nodeEnd))
815  throw Exception(what);
816 
817  list< OutPort *>::const_iterator iter=starts.begin();
818  Node *nodeStart=(*iter)->getNode();
819  iter++;
820  if(nodeEnd!=nodeStart)
821  throw Exception(what);
822 
823  for(;iter!=starts.end();iter++)
824  if((*iter)->getNode()!=nodeStart)
825  throw Exception(what);
826  //Ok at this step we are sure that we have back links on the same elementary node.
827  if(starts.size()>1)
828  for(iter=starts.begin();iter!=starts.end();iter++)
829  info.pushWarnLink(*iter,end,W_BACK_COLLAPSE_EL);
830  else//here no need to look at 'alreadyFed' var because it is waranteed to be equal to FREE_ST by construction.
831  info.pushInfoLink(*(starts.begin()),end,I_BACK);
832  alreadyFed=FED_ST;
833 }
void solveObviousOrDelegateCFLinks(const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
static const unsigned char FED_ST
Node * isInMyDescendance(Node *nodeToTest) const
Returns the parent of a node that is the direct child of this node.
Base class for all calculation nodes.
void pushInfoLink(OutPort *semStart, InPort *end, InfoReason reason)
Definition: LinkInfo.cxx:71
void pushWarnLink(OutPort *semStart, InPort *end, WarnReason reason)
Definition: LinkInfo.cxx:76
Base class for all nodes.
Definition: Node.hxx:70
Node * getNode() const
Definition: Port.hxx:46
@ W_BACK_COLLAPSE_EL
Definition: LinkInfo.hxx:62

References FED_ST, YACS::ENGINE::Port::getNode(), YACS::ENGINE::I_BACK, isInMyDescendance(), YACS::ENGINE::LinkInfo::pushInfoLink(), YACS::ENGINE::LinkInfo::pushWarnLink(), solveObviousOrDelegateCFLinks(), and YACS::ENGINE::W_BACK_COLLAPSE_EL.

Referenced by YACS::ENGINE::Loop::checkCFLinks(), and YACS::ENGINE::Switch::checkCFLinks().

◆ checkConsistency()

void ComposedNode::checkConsistency ( LinkInfo info) const

Definition at line 615 of file ComposedNode.cxx.

616 {
617  info.clearAll();
618  info.setPointOfView((ComposedNode *)this);
619  performCFComputations(info);
620  list<InputPort *> setOfInToTest=getSetOfInputPort();
621  for(list<InputPort *>::iterator iter1=setOfInToTest.begin();iter1!=setOfInToTest.end();iter1++)
622  {
623  vector<OutPort *> candidateForAdvCheck;
624  set<OutPort *> outPorts=(*iter1)->edSetOutPort();
625  //Filtering among outPorts, which of them, are candidates to fill *iter1 at the current scope.
626  for(set<OutPort *>::iterator iter2=outPorts.begin();iter2!=outPorts.end();iter2++)
627  {
628  (*iter2)->checkConsistency(info);
629  ComposedNode *manager=getLowestCommonAncestor((*iter2)->getNode(),(*iter1)->getNode());
630  if(isInMyDescendance(manager))
631  candidateForAdvCheck.push_back(*iter2);
632  }
633  if(!candidateForAdvCheck.empty())
634  //End of filtering. Now regarding CF constraints for the current InPutPort.
635  try
636  {
637  checkLinksCoherenceRegardingControl(candidateForAdvCheck,*iter1,info);
638  }
639  catch(YACS::Exception& ex)
640  {
641  std::string what=ex.what();
642  what += "\nfor input port: ";
643  what += (*iter1)->getNode()->getName();
644  what += ".";
645  what += (*iter1)->getName();
646 
648  throw YACS::Exception(what);
649  }
650  else
651  //No backlinks
652  if(!(*iter1)->canBeNull() && !(*iter1)->edIsManuallyInitialized())
653  info.pushErrLink(0,*iter1,E_NEVER_SET_INPUTPORT);
654  }
656 }
Base class for all composed nodes.
std::list< InputPort * > getSetOfInputPort() const
void checkLinksCoherenceRegardingControl(const std::vector< OutPort * > &starts, InputPort *end, LinkInfo &info) const
virtual void performCFComputations(LinkInfo &info) const
perform recursively all CF computations.
virtual void destructCFComputations(LinkInfo &info) const
destroy recursively all results of initial computations.
static ComposedNode * getLowestCommonAncestor(Node *node1, Node *node2)
Retrieves the lowest common ancestor of 2 nodes.
void pushErrLink(OutPort *semStart, InPort *end, ErrReason reason)
Definition: LinkInfo.cxx:86
void setPointOfView(ComposedNode *pov)
Definition: LinkInfo.cxx:66
@ E_NEVER_SET_INPUTPORT
Definition: LinkInfo.hxx:69

References checkLinksCoherenceRegardingControl(), YACS::ENGINE::LinkInfo::clearAll(), destructCFComputations(), YACS::ENGINE::E_NEVER_SET_INPUTPORT, testCppPluginInvokation::ex, getLowestCommonAncestor(), getSetOfInputPort(), isInMyDescendance(), performCFComputations(), YACS::ENGINE::LinkInfo::pushErrLink(), and YACS::ENGINE::LinkInfo::setPointOfView().

Referenced by main(), YACS::HMI::GenericGui::onRunLoadedSchema(), and YACS::HMI::EditionProc::synchronize().

◆ checkControlDependancy()

virtual void YACS::ENGINE::ComposedNode::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
protectedpure virtual

◆ checkDeploymentTree()

DeploymentTree ComposedNode::checkDeploymentTree ( bool  deep) const

Perform check of deployment consistency of the current graph.

Parameters
deepif true a deep check is perfomed. Typically has to be called by an executor before any attempt to launch an execution.

Definition at line 189 of file ComposedNode.cxx.

190 {
191  DeploymentTree ret;
192  list< ElementaryNode * > tasks=getRecursiveConstituents();
193  for(list< ElementaryNode * >::iterator iter=tasks.begin();iter!=tasks.end();iter++)
194  {
195  switch(ret.appendTask(*iter,(*iter)->getDynClonerIfExists(this)))
196  {
198  {
199  string what("ComposedNode::checkDeploymentTree : ServiceNode with name \""); what+=(*iter)->getName();
200  what+="\" coexists in a component with an another Task which context is incompatible with it.";
201  throw Exception(what);
202  }
204  {
205  if(deep)
206  {
207  string what("ComposedNode::checkDeploymentTree : ServiceNode with name \""); what+=(*iter)->getName();
208  what+="\" is deployable but no component is specified on it.";
209  throw Exception(what);
210  }
211  }
212  }
213  }
214  return ret;
215 }
std::list< ElementaryNode * > getRecursiveConstituents() const
static const unsigned char DUP_TASK_NOT_COMPATIBLE_WITH_EXISTING_TREE
static const unsigned char DEPLOYABLE_BUT_NOT_SPECIFIED
unsigned char appendTask(Task *task, Scheduler *cloner)

References YACS::ENGINE::DeploymentTree::appendTask(), YACS::ENGINE::DeploymentTree::DEPLOYABLE_BUT_NOT_SPECIFIED, YACS::ENGINE::DeploymentTree::DUP_TASK_NOT_COMPATIBLE_WITH_EXISTING_TREE, and getRecursiveConstituents().

Referenced by YACS::ENGINE::ServiceNode::setComponent().

◆ checkInMyDescendance()

void ComposedNode::checkInMyDescendance ( Node nodeToTest) const
protected

Check if a node is in the descendance of this node.

Note
Check that 'nodeToTest' is in descendance of 'this' OR equal to 'this'
Exceptions
Exception: If 'nodeToTest' is NOT in descendance of 'this' AND not equal to 'this'
Parameters
nodeToTest: the node to check

Definition at line 1017 of file ComposedNode.cxx.

1018 {
1019  const char whatC[]=" is not the descendance of node ";
1020  if(nodeToTest==0)
1021  {
1022  string what("node "); what+= nodeToTest->getName(); what+=" ";
1023  what+=whatC; what+=_name;
1024  throw Exception(what);
1025  }
1026  if((ComposedNode *)nodeToTest==this)
1027  return;
1028  ComposedNode *iter=nodeToTest->_father;
1029  while(iter!=0 && iter!=this)
1030  iter=iter->_father;
1031  if(iter==0)
1032  {
1033  string what("node "); what+= nodeToTest->getName(); what+=" ";
1034  what+=whatC; what+=_name;
1035  throw Exception(what);
1036  }
1037 }
std::string _name
Definition: Node.hxx:89
ComposedNode * _father
Definition: Node.hxx:90
const std::string & getName() const
Definition: Node.hxx:125

References YACS::ENGINE::Node::_father, YACS::ENGINE::Node::_name, and YACS::ENGINE::Node::getName().

Referenced by edAddLink(), edRemoveLink(), and getPortName().

◆ checkLinkPossibility()

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

Reimplemented in YACS::ENGINE::WhileLoop, YACS::ENGINE::Switch, YACS::ENGINE::OptimizerLoop, YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::DynParaLoop.

Definition at line 1447 of file ComposedNode.cxx.

1449 {
1450  if((dynamic_cast<DataFlowPort *>(start) || dynamic_cast<DataFlowPort *>(end))
1451  && (dynamic_cast<DataStreamPort *>(start) || dynamic_cast<DataStreamPort *>(end)))
1452  {//cross protocol required : deeper check needed
1453  bool isOK=false;
1454  list<ComposedNode *>::const_iterator iter;
1455  for(iter=pointsOfViewStart.begin();iter!=pointsOfViewStart.end() && !isOK;iter++)
1456  isOK=(*iter)->isRepeatedUnpredictablySeveralTimes();
1457  for(iter=pointsOfViewEnd.begin();iter!=pointsOfViewEnd.end() && !isOK;iter++)
1458  isOK=(*iter)->isRepeatedUnpredictablySeveralTimes();
1459  if(!isOK)
1460  throw Exception("ComposedNode::checkLinkPossibility : Request for cross protocol link impossible.");
1461  }
1462 }

Referenced by YACS::ENGINE::DynParaLoop::checkLinkPossibility(), and edAddLink().

◆ checkLinksCoherenceRegardingControl()

void ComposedNode::checkLinksCoherenceRegardingControl ( const std::vector< OutPort * > &  starts,
InputPort end,
LinkInfo info 
) const
protected

call it only for 'starts' to 'end' links DEALED by 'this'.

Definition at line 717 of file ComposedNode.cxx.

718 {
719  map < ComposedNode *, list<OutPort *>, SortHierarc > outputs;//forward link classical
720  vector<OutPort *> outputsCross;//forward link cross
721  map < ComposedNode *, list<OutPort *>, SortHierarc > outputsBw;//backward
722  vector<OutPort *>::const_iterator iter1;
723  //vector<DataPort *> history=((*iter1).second)[0]->calculateHistoryOfLinkWith(end);
724  //DataPort *cross=DataPort::isCrossingType(history);
725  for(iter1=starts.begin();iter1!=starts.end();iter1++)
726  {
727  ComposedNode *manager=getLowestCommonAncestor((*iter1)->getNode(),end->getNode());
728  manager->checkControlDependancy((*iter1), end, false, outputs, outputsCross, outputsBw, info);
729  }
730  //Ok now let's regarding outputs all combinations : (outputs.size())*(outputs.size()-1)/2
731  unsigned char isAlreadyFed=FREE_ST;
732  //Dealing excusively with DS. Level is useless here because simultaneity is required for DS.
733  if(outputsCross.size()>0)
734  {
735  isAlreadyFed=FED_DS_ST;
736  if(outputsCross.size()>1)
737  for(vector< OutPort *>::const_iterator iter1=outputsCross.begin();iter1!=(outputsCross.end()-2);iter1++)
738  info.pushErrLink(*iter1,end,E_COLLAPSE_DS);
739  }
740  map < ComposedNode *, list<OutPort *>, SortHierarc >::iterator iter3=outputs.begin();
741  for(;iter3!=outputs.end();iter3++)
742  ((*iter3).first)->checkCFLinks((*iter3).second,end,isAlreadyFed,true,info);
743  if(isAlreadyFed==FREE_ST)
744  if(!end->edIsManuallyInitialized())
746  isAlreadyFed=FREE_ST;
747  //
748  map < ComposedNode *, list<OutPort *>, SortHierarc >::reverse_iterator iter5=outputsBw.rbegin();
749  for(;iter5!=outputsBw.rend();iter5++)
750  ((*iter5).first)->checkCFLinks((*iter5).second,end,isAlreadyFed,false,info);
751 }
static const unsigned char FREE_ST
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
static const unsigned char FED_DS_ST
virtual bool edIsManuallyInitialized() const
Specifies if this port has been manually set by the call of InputPort::edInit.
Definition: InputPort.cxx:76
@ E_ONLY_BACKWARD_DEFINED
Definition: LinkInfo.hxx:70

References checkControlDependancy(), YACS::ENGINE::E_COLLAPSE_DS, YACS::ENGINE::E_ONLY_BACKWARD_DEFINED, YACS::ENGINE::InputPort::edIsManuallyInitialized(), FED_DS_ST, FREE_ST, getLowestCommonAncestor(), YACS::ENGINE::Port::getNode(), and YACS::ENGINE::LinkInfo::pushErrLink().

Referenced by checkConsistency().

◆ checkNoCrossHierachyWith()

void ComposedNode::checkNoCrossHierachyWith ( Node node) const
protected

This method check that G1 <- G2 <- G3 <- G1 does not happened. Typically called by methods that set a hierarchy (Bloc::edAddChild, Loop::edSetNode, ...).

Definition at line 662 of file ComposedNode.cxx.

663 {
664  ComposedNode *nodeC=dynamic_cast<ComposedNode *>(node);
665  if(!nodeC)
666  return ;
667  list<ComposedNode *> ascendants=getAllAscendanceOf();
668  if(find(ascendants.begin(),ascendants.end(),nodeC)!=ascendants.end())
669  {
670  const char what[]="ComposedNode::checkNoCrossHierachyWith : ComposedNode with name \"";
671  string stream(what); stream+=node->getName(); stream+="\" is already in hierarchy ascendance of node with name \"";
672  stream+=_name; stream+="\" ; So it can't be now in its descendance !";
673  throw Exception(stream);
674  }
675 }
std::list< ComposedNode * > getAllAscendanceOf(ComposedNode *levelToStop=0) const
Definition: Node.cxx:317

References YACS::ENGINE::Node::_name, YACS::ENGINE::Node::getAllAscendanceOf(), and YACS::ENGINE::Node::getName().

Referenced by YACS::ENGINE::DynParaLoop::checkConsistencyAndSetNode(), YACS::ENGINE::Bloc::edAddChild(), YACS::ENGINE::Switch::edSetNode(), and YACS::ENGINE::Loop::edSetNode().

◆ checkNoCyclePassingThrough()

virtual void YACS::ENGINE::ComposedNode::checkNoCyclePassingThrough ( Node node)
protectedpure virtual

◆ cleanNodes()

void ComposedNode::cleanNodes ( )
virtual

Clean the composed node in case of not clean exit.

This method should be called on a control-c or sigterm

Reimplemented from YACS::ENGINE::Node.

Definition at line 1629 of file ComposedNode.cxx.

1630 {
1631  DEBTRACE("ComposedNode::cleanNodes");
1632  list<Node *> nodes=edGetDirectDescendants();
1633  for(list<Node *>::iterator iter=nodes.begin();iter!=nodes.end();iter++)
1634  (*iter)->cleanNodes();
1635 }

References DEBTRACE, and edGetDirectDescendants().

Referenced by Handler().

◆ connected()

void ComposedNode::connected ( )

Definition at line 1491 of file ComposedNode.cxx.

1492 {
1493 }

◆ destructCFComputations()

void ComposedNode::destructCFComputations ( LinkInfo info) const
protectedvirtual

destroy recursively all results of initial computations.

Reimplemented in YACS::ENGINE::Bloc.

Definition at line 687 of file ComposedNode.cxx.

688 {
689  list<Node *> nodes=edGetDirectDescendants();
690  for(list<Node *>::iterator iter=nodes.begin();iter!=nodes.end();iter++)
691  if(dynamic_cast<ComposedNode *>(*iter))
692  ((ComposedNode *)(*iter))->destructCFComputations(info);
693 }

References edGetDirectDescendants().

Referenced by checkConsistency(), and YACS::ENGINE::Bloc::destructCFComputations().

◆ edAddCFLink()

bool ComposedNode::edAddCFLink ( Node nodeS,
Node nodeE 
)

Add a controlflow link between two nodes.

Add a controlflow link between two nodes by calling edAddLink on their control ports

Definition at line 421 of file ComposedNode.cxx.

422 {
423  return edAddLink(nodeS->getOutGate(),nodeE->getInGate());
424 }
bool edAddLink(OutPort *start, InPort *end)
Add a dataflow link between two data ports.
OutGate * getOutGate()
Definition: Node.hxx:124
InGate * getInGate()
Definition: Node.hxx:123

References edAddLink(), YACS::ENGINE::Node::getInGate(), and YACS::ENGINE::Node::getOutGate().

Referenced by YACS::ENGINE::Bloc::Bloc(), edAddDFLink(), YACS::HMI::CommandAddControlLink::localExecute(), and YACS::HMI::SubjectNode::restoreLinks().

◆ edAddChild()

◆ edAddDFLink()

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

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

Connect the ports with a data link (edAddLink) and add a control flow link between the children of the lowest common ancestor node.

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

Reimplemented in YACS::ENGINE::Loop, and YACS::ENGINE::DynParaLoop.

Definition at line 333 of file ComposedNode.cxx.

334 {
335  Node* n1=start->getNode();
336  Node* n2=end->getNode();
337  DEBTRACE( n1->getName() << ":" << n2->getName())
338  ComposedNode* father=getLowestCommonAncestor(n1,n2);
339  DEBTRACE( "ComposedNode::edAddDFLink: this="<<this->getName()
340  << " father=" << father->getName() )
342  << " InPort=" << end->getName() )
343  if (father != this)
344  {
345  bool ret = father->edAddDFLink(start,end); // special treatement for loop
346  return ret;
347  }
348  if(n2 == father)
349  throw Exception("Back link authorized only in special context (loop for example)");
350 
351  bool ret= edAddLink(start,end);
352  if(n1 != father)
353  {
354  //add a control link only if nodes are not in the same descendance
355  //if n1 == father (n2 is after n1) : the control link is not needed
356  //if n2 == father (n1 is after n2) : it's a back link authorized only in loop context
357  while(n1->getFather() != father)
358  n1=n1->getFather();
359  while(n2->getFather() != father)
360  n2=n2->getFather();
361  try
362  {
363  edAddCFLink(n1,n2);
364  }
365  catch (Exception& ex)
366  {
367  // --- remove DF link already created in case of cycle dtection
368  DEBTRACE("Cycle detected, remove CF link");
369  if(start->isAlreadyLinkedWith(end))
370  edRemoveLink(start, end);
371  throw ex;
372  }
373  }
374  return ret;
375 }
std::string getName() const
virtual bool edAddDFLink(OutPort *start, InPort *end)
Connect an OutPort to an InPort and add the necessary control link.
bool edAddCFLink(Node *nodeS, Node *nodeE)
Add a controlflow link between two nodes.
void edRemoveLink(OutPort *start, InPort *end)
Remove a dataflow link.
virtual bool isAlreadyLinkedWith(InPort *withp) const =0

References DEBTRACE, edAddCFLink(), edAddDFLink(), edAddLink(), edRemoveLink(), testCppPluginInvokation::ex, YACS::ENGINE::Node::getFather(), getLowestCommonAncestor(), getName(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Port::getNode(), and YACS::ENGINE::OutPort::isAlreadyLinkedWith().

Referenced by edAddDFLink(), YACS::ENGINE::ElementaryNode::getReadyTasks(), YACS::HMI::CommandAddLink::localExecute(), and YACS::HMI::SubjectNode::restoreLinks().

◆ edAddLink() [1/2]

bool ComposedNode::edAddLink ( OutGate start,
InGate end 
)

Add a controlflow link between two control ports.

Note
Precondition : 'start' AND 'end' are in/outGate contained in a node in DIRECT descendance of 'this'.
Exceptions
Exception: If a cycle has been detected, or incompatibility between input and output, or 'start'/'end' is/are NOT in/outputPort contained in a node in descendance of 'this', or a mutilple link to an input not supporting it.
Returns
true if a new link has been created, false otherwise.

Definition at line 387 of file ComposedNode.cxx.

388 {
389  Node* n1=start->getNode();
390  Node* n2=end->getNode();
391  if(n1==n2)
392  throw Exception("ComposedNode::edAddLink: can not add a control link to a node with itself",1);
393  ComposedNode* father=checkHavingCommonFather(start->getNode(),end->getNode());
394  if(father==0)
395  throw Exception("ComposedNode::edAddLink: Trying to add CF link on orphan nodes.");
396  if(father!=this)
397  {
398  checkInMyDescendance(father);
399  return father->edAddLink(start,end);
400  }
401  bool ret=start->edAddInGate(end);
402  if(ret)
403  try
404  {
406  }
407  catch (Exception& ex)
408  {
409  // --- remove created CF link in case of cycle detection
410  DEBTRACE("Cycle detected, remove CF link");
411  edRemoveCFLink(start->getNode(), end->getNode());
412  throw ex;
413  }
414  return ret;
415 }
void edRemoveCFLink(Node *nodeS, Node *nodeE)
Remove a controlflow link.
void checkInMyDescendance(Node *nodeToTest) const
Check if a node is in the descendance of this node.
virtual void checkNoCyclePassingThrough(Node *node)=0
static ComposedNode * checkHavingCommonFather(Node *node1, Node *node2)
Definition: Node.cxx:468
bool edAddInGate(InGate *inGate)
Definition: OutGate.cxx:98

References YACS::ENGINE::Node::checkHavingCommonFather(), checkInMyDescendance(), checkNoCyclePassingThrough(), DEBTRACE, YACS::ENGINE::OutGate::edAddInGate(), edAddLink(), edRemoveCFLink(), testCppPluginInvokation::ex, and YACS::ENGINE::Port::getNode().

◆ edAddLink() [2/2]

bool ComposedNode::edAddLink ( OutPort start,
InPort end 
)

Add a dataflow link between two data ports.

Precondition : 'start' AND 'end' are in/outputPort contained in a node in descendance of 'this'.

Exceptions
Exception: if incompatibility between input and output (type), or 'start'/'end' is/are NOT in/outputPort contained in a node in descendance of 'this', or a multiple link to an input not supporting it.
Returns
true if a new link has been created, false otherwise.

Definition at line 273 of file ComposedNode.cxx.

274 {
275  DEBTRACE("ComposedNode::edAddLink");
276  set<OutPort *> represented;
277 
278  start->getAllRepresented(represented);
279  if(represented.size()!=1)
280  {
281  bool ret=false;
282  for(set<OutPort *>::iterator iter=represented.begin();iter!=represented.end();iter++)
283  ret|=edAddLink(*iter,end);
284  return ret;
285  }
286  if(start->isAlreadyLinkedWith(end))
287  return false;
288  ComposedNode* lwstCmnAnctr=getLowestCommonAncestor(start->getNode(),end->getNode());
289  list<ComposedNode *> allAscendanceOfNodeStart=start->getNode()->getAllAscendanceOf(lwstCmnAnctr);
290  list<ComposedNode *> allAscendanceOfNodeEnd=end->getNode()->getAllAscendanceOf(lwstCmnAnctr);
291  checkInMyDescendance(lwstCmnAnctr);
292  lwstCmnAnctr->checkLinkPossibility(start,allAscendanceOfNodeStart,end,allAscendanceOfNodeEnd);
293  ComposedNode *iterS;
294  if(dynamic_cast<ComposedNode *>(start->getNode()))
295  iterS=(ComposedNode *)start->getNode();
296  else
297  iterS=start->getNode()->_father;
298  pair<OutPort *, OutPort *> pO(start,start);
299  while(iterS!=lwstCmnAnctr)
300  {
301  iterS->buildDelegateOf(pO, end, allAscendanceOfNodeEnd);
302  iterS=iterS->_father;
303  }
304  if(dynamic_cast<ComposedNode *>(end->getNode()))
305  iterS=(ComposedNode *)end->getNode();
306  else
307  iterS=end->getNode()->_father;
308 
309  InPort *currentPortI=end;
310  bool isLoopProofLink(true),isFirstTurn(true);
311  while(iterS!=lwstCmnAnctr)
312  {
313  if(!isFirstTurn && iterS->isLoop())// isFirstTurn is a way to filter special inputs like nbBranches, splitPort... These special inputs are loopProof -> they must not be realeased by ForEachLoop::exUpdateState
314  isLoopProofLink=false;
315  iterS->buildDelegateOf(currentPortI, start, allAscendanceOfNodeStart);
316  iterS=iterS->_father;
317  isFirstTurn=false;
318  }
319  bool ret=(pO.first)->addInPort(currentPortI);
320  end->edNotifyReferencedBy(pO.second,isLoopProofLink);
321  return ret;
322 }
virtual void buildDelegateOf(InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
virtual bool isLoop() const
virtual void checkLinkPossibility(OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)
virtual void edNotifyReferencedBy(OutPort *fromPort, bool isLoopProof=true)
Definition: InPort.cxx:93
virtual void getAllRepresented(std::set< OutPort * > &represented) const
Definition: OutPort.cxx:45

References YACS::ENGINE::Node::_father, buildDelegateOf(), checkInMyDescendance(), checkLinkPossibility(), DEBTRACE, YACS::ENGINE::InPort::edNotifyReferencedBy(), YACS::ENGINE::Node::getAllAscendanceOf(), YACS::ENGINE::OutPort::getAllRepresented(), getLowestCommonAncestor(), YACS::ENGINE::Port::getNode(), YACS::ENGINE::OutPort::isAlreadyLinkedWith(), and isLoop().

Referenced by YACS::ENGINE::Bloc::Bloc(), YACS::ENGINE::Loop::buildDelegateOf(), YACS::ENGINE::DynParaLoop::cloneAndPlaceNodesCoherently(), YACS::ENGINE::DynParaLoop::DynParaLoop(), edAddCFLink(), edAddDFLink(), YACS::ENGINE::DynParaLoop::edAddDFLink(), YACS::ENGINE::Loop::edAddDFLink(), edAddLink(), YACS::ENGINE::ForLoop::ForLoop(), YACS::ENGINE::ElementaryNode::getReadyTasks(), YACS::HMI::CommandAddLink::localExecute(), YACS::ENGINE::OptimizerLoop::OptimizerLoop(), YACS::HMI::SubjectNode::restoreLinks(), and YACS::ENGINE::WhileLoop::WhileLoop().

◆ edDisconnectAllLinksWithMe()

void ComposedNode::edDisconnectAllLinksWithMe ( )
protectedvirtual

Called typically by ComposedNode to correctly update DF/CF/DS links

Reimplemented from YACS::ENGINE::Node.

Definition at line 903 of file ComposedNode.cxx.

904 {
905  //CF
906  DEBTRACE("-");
908  //Leaving part
909  DEBTRACE("--");
910  vector< pair<OutPort *, InPort *> > linksToDestroy=getSetOfLinksLeavingCurrentScope();
911  vector< pair<OutPort *, InPort *> >::iterator iter;
912  for(iter=linksToDestroy.begin();iter!=linksToDestroy.end();iter++)
913  {
914  DEBTRACE("---");
915  (*iter).first->removeInPort((*iter).second,true);
916  }
917  //Arriving part
918  vector< pair<InPort *, OutPort *> > linksToDestroy2=getSetOfLinksComingInCurrentScope();
919  vector< pair<InPort *, OutPort *> >::iterator iter2;
920  for(iter2=linksToDestroy2.begin();iter2!=linksToDestroy2.end();iter2++)
921  {
922  DEBTRACE("----");
923  (*iter2).second->removeInPort((*iter2).first,true);
924  }
925 }
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope() const
virtual std::vector< std::pair< InPort *, OutPort * > > getSetOfLinksComingInCurrentScope() const
virtual void edDisconnectAllLinksWithMe()
Definition: Node.cxx:395

References DEBTRACE, YACS::ENGINE::Node::edDisconnectAllLinksWithMe(), getSetOfLinksComingInCurrentScope(), and getSetOfLinksLeavingCurrentScope().

◆ edGetDirectDescendants()

◆ edRemoveCFLink()

void ComposedNode::edRemoveCFLink ( Node nodeS,
Node nodeE 
)

◆ edRemoveChild()

void ComposedNode::edRemoveChild ( Node node)
virtual

◆ edRemoveLink() [1/2]

void ComposedNode::edRemoveLink ( OutGate start,
InGate end 
)

Remove a controlflow link.

Definition at line 523 of file ComposedNode.cxx.

524 {
525  ComposedNode* father=checkHavingCommonFather(start->getNode(),end->getNode());
526  if(father!=this)
527  throw Exception("edRemoveLink : nodes not in direct descendance of this");
528  start->edRemoveInGate(end);
529 }
void edRemoveInGate(InGate *inGate, bool coherenceWithInGate=true)
Definition: OutGate.cxx:120

References YACS::ENGINE::Node::checkHavingCommonFather(), YACS::ENGINE::OutGate::edRemoveInGate(), and YACS::ENGINE::Port::getNode().

◆ edRemoveLink() [2/2]

void ComposedNode::edRemoveLink ( OutPort start,
InPort end 
)

Remove a dataflow link.

Precondition : 'start' AND 'end' are in/outputPort contained in a node in descendance of 'this'.

Exceptions
Exception: If the specified link does not exist. The content of Exception is different in accordance with the link from 'start' to 'end' implies DF/DS gateway.

Definition at line 441 of file ComposedNode.cxx.

442 {
443  if(!start->isAlreadyLinkedWith(end))
444  throw Exception("ComposedNode::edRemoveLink : unexisting link");
445  ComposedNode* lwstCmnAnctr=getLowestCommonAncestor(start->getNode(),end->getNode());
446  checkInMyDescendance(lwstCmnAnctr);
447  list<ComposedNode *> allAscendanceOfNodeStart=start->getNode()->getAllAscendanceOf(lwstCmnAnctr);
448  list<ComposedNode *> allAscendanceOfNodeEnd=end->getNode()->getAllAscendanceOf(lwstCmnAnctr);
449 
450  // --- Part of test if the link from 'start' to 'end' really exist particulary all eventually intermediate ports created
451 
452  ComposedNode *iterS=start->getNode()->_father;
453  pair<OutPort *,OutPort *> currentPortO(start,start);
454  vector<pair< ComposedNode * , pair < OutPort* , OutPort *> > > needsToDestroyO;
455 
456  Node *nodeOTemp=start->getNode();
457  if(*nodeOTemp<*lwstCmnAnctr)
458  {
459  iterS=nodeOTemp->_father;
460  while(iterS!=lwstCmnAnctr)
461  {
462  if (!iterS)
463  {
464  stringstream what;
465  what << "ComposedNode::edRemoveLink: "
466  << start->getNode()->getName() << "." <<start->getName() << "->"
467  << end->getNode()->getName() << "." << end->getName();
468  throw Exception(what.str());
469  }
470  OutPort *tmp=currentPortO.first;
471  iterS->getDelegateOf(currentPortO, end, allAscendanceOfNodeEnd);
472  needsToDestroyO.push_back(pair< ComposedNode * , pair < OutPort* , OutPort *> >(iterS,pair<OutPort* , OutPort *> (tmp,currentPortO.first)));
473  iterS=iterS->_father;
474  }
475  }
476  Node *nodeTemp=end->getNode();
477  InPort * currentPortI=end;
478  if(*nodeTemp<*lwstCmnAnctr)
479  {
480  iterS=nodeTemp->_father;
481  while(iterS!=lwstCmnAnctr)
482  {
483  if (!iterS)
484  {
485  stringstream what;
486  what << "ComposedNode::edRemoveLink: "
487  << start->getNode()->getName() << "." <<start->getName() << "->"
488  << end->getNode()->getName() << "." << end->getName();
489  throw Exception(what.str());
490  }
491  iterS->getDelegateOf(currentPortI, start, allAscendanceOfNodeStart);
492  iterS=iterS->_father;
493  }
494  }
495  // --- End of test for evt intermediate ports created
496 
497  (currentPortO.first)->removeInPort(currentPortI,false);
498  set<OutPort *> repr;
499  (currentPortO.second)->getAllRepresented(repr);
500  if(repr.size()==1)
501  end->edNotifyDereferencedBy(currentPortO.second);
502 
503  // --- Performing deletion of intermediate ports
504 
505  iterS=start->getNode()->_father;
506  vector<pair< ComposedNode * , pair < OutPort* , OutPort *> > >::reverse_iterator iter;
507  for(iter=needsToDestroyO.rbegin();iter!=needsToDestroyO.rend();iter++)
508  (*iter).first->releaseDelegateOf(((*iter).second).first, ((*iter).second).second, end,allAscendanceOfNodeEnd);
509  nodeTemp=end->getNode();
510  if(*nodeTemp<*lwstCmnAnctr)
511  {
512  iterS=end->getNode()->_father;
513  currentPortI=end;
514  while(iterS!=lwstCmnAnctr)
515  {
516  iterS->releaseDelegateOf(currentPortI, start, allAscendanceOfNodeStart);
517  iterS=iterS->_father;
518  }
519  }
520 }
virtual void getDelegateOf(InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
virtual void releaseDelegateOf(InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
std::string getName() const
Definition: DataPort.hxx:55
virtual void edNotifyDereferencedBy(OutPort *fromPort)
Definition: InPort.cxx:102

References YACS::ENGINE::Node::_father, checkInMyDescendance(), YACS::ENGINE::InPort::edNotifyDereferencedBy(), YACS::ENGINE::Node::getAllAscendanceOf(), getDelegateOf(), getLowestCommonAncestor(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Port::getNode(), YACS::ENGINE::OutPort::isAlreadyLinkedWith(), and releaseDelegateOf().

Referenced by edAddDFLink(), YACS::ENGINE::InPort::edRemoveAllLinksLinkedWithMe(), edRemoveCFLink(), YACS::ENGINE::OutputDataStreamPort::edRemoveInputDataStreamPort(), YACS::ENGINE::OutputPort::edRemoveInputPort(), and YACS::HMI::SubjectLink::localclean().

◆ edUpdateState()

void ComposedNode::edUpdateState ( )
virtual

update the status of the node

Only useful when editing a schema Do nothing in base Node : to implement in derived classes

Reimplemented from YACS::ENGINE::Node.

Definition at line 1532 of file ComposedNode.cxx.

1533 {
1534  DEBTRACE("ComposedNode::edUpdateState(): " << _state << " " << _modified);
1536 
1537  try
1538  {
1540  _errorDetails="";
1541  }
1542  catch(Exception& e)
1543  {
1545  _errorDetails=e.what();
1546  }
1547  DEBTRACE("ComposedNode::edUpdateState: " << _errorDetails);
1548 
1549  //update children if needed
1550  list<Node *> constituents=edGetDirectDescendants();
1551  for(list<Node *>::iterator iter=constituents.begin(); iter!=constituents.end(); iter++)
1552  {
1553  if(!(*iter)->isValid())
1555  }
1556  if(state != _state)
1557  setState(state);
1558  _modified=0;
1559 }
virtual void checkBasicConsistency() const
void setState(YACS::StatesForNode theState)
Sets the given state for node.
Definition: Node.cxx:652
std::string _errorDetails
Definition: Node.hxx:93
YACS::StatesForNode _state
Definition: Node.hxx:91
StatesForNode
Definition: define.hxx:34
@ INVALID
Definition: define.hxx:36
@ READY
Definition: define.hxx:37

References YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::Node::_modified, YACS::ENGINE::Node::_state, checkBasicConsistency(), DEBTRACE, edGetDirectDescendants(), YACS::INVALID, YACS::READY, YACS::ENGINE::Node::setState(), yacsorb.CORBAEngineTest::state, and YACS::Exception::what().

Referenced by YACS::ENGINE::Proc::modified(), and YACS::ENGINE::Proc::setEdition().

◆ getAllInPortsComingFromOutsideOfCurrentScope()

std::set< InPort * > ComposedNode::getAllInPortsComingFromOutsideOfCurrentScope ( ) const
virtual

List all input ports that are linked to out of scope ports.

List all input ports of 'this' so that, for each it exists at least 1 link coming from outside to it.

Implements YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::Switch.

Definition at line 885 of file ComposedNode.cxx.

886 {
887  set<InPort *> ret;
888  list<InPort *> temp=getSetOfInPort();
889  for(list<InPort *>::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
890  {
891  set<OutPort *> temp2=(*iter2)->edSetOutPort();
892  for(set<OutPort *>::iterator iter3=temp2.begin();iter3!=temp2.end();iter3++)
893  if(*iter3)
894  if(!isInMyDescendance((*iter3)->getNode()))
895  {
896  ret.insert(*iter2);
897  break;
898  }
899  }
900  return ret;
901 }
std::list< InPort * > getSetOfInPort() const
Definition: Node.cxx:289

References YACS::ENGINE::Node::getSetOfInPort(), and isInMyDescendance().

Referenced by YACS::ENGINE::ForEachLoopGen::exUpdateState(), YACS::ENGINE::Switch::getAllInPortsComingFromOutsideOfCurrentScope(), getSetOfLinksComingInCurrentScope(), and YACS::ENGINE::DynParaLoop::prepareInputsFromOutOfScope().

◆ getAllOutPortsLeavingCurrentScope()

std::set< OutPort * > ComposedNode::getAllOutPortsLeavingCurrentScope ( ) const
virtual

List all output ports of children nodes that are linked to out of scope input ports.

Note
List all output ports of nodes sons of 'this' that are linked to input ports of nodes not in descendance of 'this'. This method contrary to getAllInPortsComingFromOutsideOfCurrentScope is NOT virtual because for the moment all daughter classes have no more hidden YACS::ENGINE::OutPort.

Implements YACS::ENGINE::Node.

Definition at line 861 of file ComposedNode.cxx.

862 {
863  set<OutPort *> ret;
864  list<OutPort *> temp=getSetOfOutPort();
865  for(list<OutPort *>::iterator iter2=temp.begin();iter2!=temp.end();iter2++)
866  {
867  set<InPort *> temp2=(*iter2)->edSetInPort();
868  for(set<InPort *>::iterator iter3=temp2.begin();iter3!=temp2.end();iter3++)
869  if(!isInMyDescendance((*iter3)->getNode()))
870  {
871  ret.insert(*iter2);
872  break;
873  }
874  }
875  return ret;
876 }
std::list< OutPort * > getSetOfOutPort() const
Definition: Node.cxx:299

References YACS::ENGINE::Node::getSetOfOutPort(), and isInMyDescendance().

Referenced by YACS::ENGINE::ForEachLoopGen::exUpdateState(), YACS::ENGINE::ForLoop::exUpdateState(), YACS::ENGINE::OptimizerLoop::exUpdateState(), YACS::ENGINE::Switch::exUpdateState(), YACS::ENGINE::WhileLoop::exUpdateState(), getSetOfLinksLeavingCurrentScope(), and YACS::ENGINE::OptimizerLoop::initInterceptors().

◆ getAllRecursiveConstituents()

list< Node * > ComposedNode::getAllRecursiveConstituents ( )
virtual

Idem getAllRecursiveNodes, but this node is NOT included.

Definition at line 1134 of file ComposedNode.cxx.

1135 {
1136  list<Node *> ret;
1137  list<Node *> setOfNode=edGetDirectDescendants();
1138  for(list<Node *>::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1139  {
1140  if ( dynamic_cast<ComposedNode*> (*iter) )
1141  {
1142  list<Node *> myCurrentSet=((ComposedNode*)(*iter))->getAllRecursiveConstituents();
1143  ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
1144  ret.push_back(*iter);
1145  }
1146  else
1147  {
1148  list<ElementaryNode *> myCurrentSet=(*iter)->getRecursiveConstituents();
1149  ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
1150  }
1151  }
1152  return ret;
1153 }
virtual std::list< Node * > getAllRecursiveConstituents()
Idem getAllRecursiveNodes, but this node is NOT included.

References edGetDirectDescendants().

Referenced by YACS::ENGINE::OptimizerLoop::finalize(), YACS::ENGINE::DynParaLoop::forwardExecStateToOriginalBody(), YACS::ENGINE::Proc::getIds(), YACS::ENGINE::Proc::getNumIds(), and YACS::ENGINE::ForEachLoopGen::updateStateForWorkNodeOnFinishedEventFrom().

◆ getAllRecursiveNodes()

list< Node * > ComposedNode::getAllRecursiveNodes ( )

Get all children nodes elementary and composed including this node.

Definition at line 1156 of file ComposedNode.cxx.

1157 {
1158  list<Node *> ret;
1159  list<Node *> setOfNode=edGetDirectDescendants();
1160  for(list<Node *>::iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1161  {
1162  if ( dynamic_cast<ElementaryNode*> (*iter) )
1163  {
1164  list<ElementaryNode *> myCurrentSet=(*iter)->getRecursiveConstituents();
1165  ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
1166  }
1167  else
1168  {
1169  list<Node *> myCurrentSet=((ComposedNode*)(*iter))->getAllRecursiveNodes();
1170  ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
1171  }
1172  }
1173  ret.push_back(this);
1174  return ret;
1175 }
std::list< Node * > getAllRecursiveNodes()
Get all children nodes elementary and composed including this node.

References edGetDirectDescendants().

Referenced by main(), and YACS::HMI::SubjectNode::registerUndoDestroy().

◆ getChildByName()

Node * ComposedNode::getChildByName ( const std::string &  name) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 999 of file ComposedNode.cxx.

1000 {
1001  string potentiallyDirectSonName, remainsPath;
1002  bool forwardNeeded=ComposedNode::splitNamesBySep(name, SEP_CHAR_BTW_LEVEL,
1003  potentiallyDirectSonName,remainsPath,false);
1004  Node *child=getChildByShortName(potentiallyDirectSonName);
1005  if(!forwardNeeded)
1006  return child;
1007  else
1008  return child->getChildByName(remainsPath);
1009 }
static const char SEP_CHAR_BTW_LEVEL[]
virtual Node * getChildByShortName(const std::string &name) const =0
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.
virtual Node * getChildByName(const std::string &name) const =0

References YACS::ENGINE::Node::getChildByName(), getChildByShortName(), SEP_CHAR_BTW_LEVEL, and splitNamesBySep().

Referenced by YACS::ENGINE::Bloc::Bloc(), YACS::ENGINE::DynParaLoop::cloneAndPlaceNodesCoherently(), DefineCustomObservers(), YACS::ENGINE::DynParaLoop::forwardExecStateToOriginalBody(), YACS::ENGINE::DynParaLoop::getDynInputPortByAbsName(), YACS::ENGINE::ForEachLoopGen::getDynOutPortByAbsName(), getInputDataStreamPort(), getInputPort(), YACS::HMI::SceneBlocItem::getNodesInfo(), getOutputDataStreamPort(), YACS::HMI::YACSGuiLoader::getPrsData(), YACS::HMI::CommandAddNodeFromCatalog::localExecute(), YACS::HMI::CommandReparentNode::localExecute(), YACS::HMI::CommandPutInComposedNode::localExecute(), YACS::HMI::CommandCopyNode::localExecute(), YACS::HMI::CommandRenameNode::localExecute(), YACS::HMI::CommandRenameInDataPort::localExecute(), YACS::HMI::CommandRenameOutDataPort::localExecute(), YACS::HMI::CommandAddInputPortFromCatalog::localExecute(), YACS::HMI::CommandAddOutputPortFromCatalog::localExecute(), YACS::HMI::CommandAddIDSPortFromCatalog::localExecute(), YACS::HMI::CommandAddODSPortFromCatalog::localExecute(), YACS::HMI::CommandOrderInputPorts::localExecute(), YACS::HMI::CommandOrderOutputPorts::localExecute(), YACS::HMI::CommandSetInPortValue::localExecute(), YACS::HMI::CommandSetOutPortValue::localExecute(), YACS::HMI::CommandSetSwitchSelect::localExecute(), YACS::HMI::CommandSetSwitchCase::localExecute(), YACS::HMI::CommandSetForLoopSteps::localExecute(), YACS::HMI::CommandSetWhileCondition::localExecute(), YACS::HMI::CommandSetForEachBranch::localExecute(), YACS::HMI::CommandSetAlgo::localExecute(), YACS::HMI::CommandAddLink::localExecute(), YACS::HMI::CommandAddControlLink::localExecute(), YACS::HMI::CommandSetNodeProperties::localExecute(), YACS::HMI::CommandSetDSPortProperties::localExecute(), YACS::HMI::CommandSetLinkProperties::localExecute(), YACS::HMI::CommandSetFuncNodeFunctionName::localExecute(), YACS::HMI::CommandSetInlineNodeScript::localExecute(), YACS::HMI::CommandSetExecutionMode::localExecute(), YACS::HMI::CommandSetContainer::localExecute(), YACS::HMI::CommandAssociateServiceToComponent::localExecute(), YACS::HMI::CommandAddComponentFromCatalog::localExecute(), YACS::HMI::CommandDestroy::localExecute(), YACS::HMI::CommandAddNodeFromCatalog::localReverse(), YACS::HMI::CommandReparentNode::localReverse(), YACS::HMI::CommandPutInComposedNode::localReverse(), YACS::HMI::CommandCopyNode::localReverse(), YACS::HMI::CommandRenameNode::localReverse(), YACS::HMI::CommandRenameInDataPort::localReverse(), YACS::HMI::CommandRenameOutDataPort::localReverse(), YACS::HMI::CommandAddInputPortFromCatalog::localReverse(), YACS::HMI::CommandAddOutputPortFromCatalog::localReverse(), YACS::HMI::CommandAddIDSPortFromCatalog::localReverse(), YACS::HMI::CommandAddODSPortFromCatalog::localReverse(), YACS::HMI::CommandOrderInputPorts::localReverse(), YACS::HMI::CommandOrderOutputPorts::localReverse(), YACS::HMI::CommandSetInPortValue::localReverse(), YACS::HMI::CommandSetOutPortValue::localReverse(), YACS::HMI::CommandSetSwitchSelect::localReverse(), YACS::HMI::CommandSetSwitchCase::localReverse(), YACS::HMI::CommandSetForLoopSteps::localReverse(), YACS::HMI::CommandSetWhileCondition::localReverse(), YACS::HMI::CommandSetForEachBranch::localReverse(), YACS::HMI::CommandSetAlgo::localReverse(), YACS::HMI::CommandAddLink::localReverse(), YACS::HMI::CommandAddControlLink::localReverse(), YACS::HMI::CommandSetNodeProperties::localReverse(), YACS::HMI::CommandSetDSPortProperties::localReverse(), YACS::HMI::CommandSetLinkProperties::localReverse(), YACS::HMI::CommandSetFuncNodeFunctionName::localReverse(), YACS::HMI::CommandSetInlineNodeScript::localReverse(), YACS::HMI::CommandSetExecutionMode::localReverse(), YACS::HMI::CommandSetContainer::localReverse(), YACS::HMI::CommandAssociateServiceToComponent::localReverse(), YACS::HMI::CommandAddComponentFromCatalog::localReverse(), performDuplicationOfPlacement(), performShallowDuplicationOfPlacement(), YACS::HMI::GuiObserver_i::setConversion(), and YACS::ENGINE::Node::setName().

◆ getChildByShortName()

virtual Node* YACS::ENGINE::ComposedNode::getChildByShortName ( const std::string &  name) const
protectedpure virtual

◆ getChildName()

string ComposedNode::getChildName ( const Node node) const

Definition at line 968 of file ComposedNode.cxx.

969 {
970  string nodeName=node->getQualifiedName();
971  if (!isNodeAlreadyAggregated(node))
972  {
973  if (node->getName() == "thisIsAFakeNode")
974  {
975  string child = node->getName()+".thisIsAFakeNode";
976  return child;
977  }
978  else
979  {
980  string what("node "); what+= node->getName() ; what+=" is not a child of node "; what += getName();
981  throw Exception(what);
982  }
983  }
984 
985  const Node *father = node->_father;
986  while (father != this)
987  {
988  nodeName = father->getQualifiedName() + SEP_CHAR_BTW_LEVEL + nodeName;
989  father = father->_father;
990  }
991  return nodeName;
992 }
bool isNodeAlreadyAggregated(const Node *node) const
Check that Node 'node' is already a direct son of this.
std::string getQualifiedName() const
same as Node::getName() in most cases, but differs for children of switch
Definition: Node.cxx:632

References YACS::ENGINE::Node::_father, getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Node::getQualifiedName(), isNodeAlreadyAggregated(), and SEP_CHAR_BTW_LEVEL.

Referenced by YACS::HMI::SubjectElementaryNode::addIDSPort(), YACS::HMI::SubjectElementaryNode::addInputPort(), YACS::HMI::SubjectElementaryNode::addODSPort(), YACS::HMI::SubjectElementaryNode::addOutputPort(), YACS::HMI::SceneBlocItem::arrangeCanvasNodes(), YACS::HMI::SubjectServiceNode::associateToComponent(), YACS::ENGINE::Bloc::Bloc(), YACS::HMI::SubjectNode::copy(), YACS::HMI::SubjectComposedNode::createNode(), YACS::HMI::Subject::destroy(), YACS::HMI::EditionNode::EditionNode(), YACS::ENGINE::DynParaLoop::forwardExecStateToOriginalBody(), YACS::ENGINE::Node::getDPLScopeInfo(), YACS::ENGINE::Node::getId(), YACS::ENGINE::Proc::getIds(), YACS::ENGINE::LinkInfo::getInfoRepr(), YACS::HMI::SceneBlocItem::getNodesInfo(), getTaskName(), YACS::HMI::CommandReparentNode::localExecute(), YACS::HMI::CommandPutInComposedNode::localExecute(), YACS::HMI::CommandRenameNode::localExecute(), YACS::HMI::CommandSetSwitchCase::localExecute(), YACS::HMI::CommandPutInComposedNode::localReverse(), YACS::HMI::SubjectElementaryNode::OrderDataPorts(), performDuplicationOfPlacement(), performShallowDuplicationOfPlacement(), YACS::HMI::SubjectNode::putInComposedNode(), YACS::HMI::SubjectDataPort::registerUndoDestroy(), YACS::HMI::SubjectInputDataStreamPort::registerUndoDestroy(), YACS::HMI::SubjectOutputDataStreamPort::registerUndoDestroy(), YACS::HMI::SubjectNode::registerUndoDestroy(), YACS::HMI::SubjectLink::registerUndoDestroy(), YACS::HMI::SubjectControlLink::registerUndoDestroy(), YACS::HMI::SubjectNode::reparent(), YACS::HMI::SubjectOptimizerLoop::setAlgorithm(), YACS::HMI::SubjectSwitch::setCase(), YACS::HMI::SubjectServiceNode::setComponentFromCatalog(), YACS::HMI::SubjectWhileLoop::setCondition(), YACS::HMI::SubjectInlineNode::setContainer(), YACS::HMI::SubjectInlineNode::setExecutionMode(), YACS::HMI::SubjectPyFuncNode::setFunctionName(), YACS::HMI::GuiExecutor::setInPortValue(), YACS::HMI::SubjectDataPort::setName(), YACS::HMI::SubjectNode::setName(), YACS::HMI::SubjectDynParaLoop::setNbBranches(), YACS::HMI::SubjectForLoop::setNbSteps(), YACS::HMI::SubjectInputDataStreamPort::setProperties(), YACS::HMI::SubjectOutputDataStreamPort::setProperties(), YACS::HMI::SubjectNode::setProperties(), YACS::HMI::SubjectLink::setProperties(), YACS::HMI::SubjectInlineNode::setScript(), YACS::HMI::SubjectSwitch::setSelect(), YACS::HMI::SubjectInputPort::setValue(), YACS::HMI::SubjectOutputPort::setValue(), YACS::HMI::SubjectControlLink::SubjectControlLink(), YACS::HMI::SubjectLink::SubjectLink(), YACS::HMI::SchemaNodeItem::toggleState(), YACS::HMI::SubjectDataPort::tryCreateLink(), YACS::HMI::SubjectNode::tryCreateLink(), YACS::HMI::EditionNode::update(), YACS::HMI::SchemaComponentItem::update(), YACS::ENGINE::VisitorSaveSchema::visitBloc(), YACS::ENGINE::VisitorSaveState::visitBloc(), YACS::ENGINE::VisitorSaveSchema::visitDynParaLoop(), YACS::ENGINE::VisitorSaveSchema::visitElementaryNode(), YACS::ENGINE::VisitorSaveState::visitElementaryNode(), YACS::ENGINE::VisitorSalomeSaveState::visitForEachLoop(), YACS::ENGINE::VisitorSaveSchema::visitForEachLoop(), YACS::ENGINE::VisitorSaveState::visitForEachLoop(), YACS::ENGINE::VisitorSaveSchema::visitForEachLoopDyn(), YACS::ENGINE::VisitorSaveState::visitForEachLoopDyn(), YACS::ENGINE::VisitorSaveSchema::visitForLoop(), YACS::ENGINE::VisitorSaveState::visitForLoop(), YACS::ENGINE::VisitorSaveSchema::visitInlineFuncNode(), YACS::ENGINE::VisitorSaveSchema::visitInlineNode(), YACS::ENGINE::VisitorSaveSchema::visitLoop(), YACS::ENGINE::VisitorSaveState::visitLoop(), YACS::ENGINE::VisitorSaveSchema::visitOptimizerLoop(), YACS::ENGINE::VisitorSaveState::visitOptimizerLoop(), YACS::ENGINE::VisitorSaveSchema::visitOutNode(), YACS::ENGINE::VisitorSaveSalomeSchema::visitOutNode(), YACS::ENGINE::VisitorSaveSchema::visitPresetNode(), YACS::ENGINE::VisitorSaveSalomeSchema::visitPresetNode(), YACS::ENGINE::VisitorSaveState::visitProc(), YACS::ENGINE::VisitorSaveSchema::visitServerNode(), YACS::ENGINE::VisitorSaveSchema::visitServiceInlineNode(), YACS::ENGINE::VisitorSaveSchema::visitServiceNode(), YACS::ENGINE::VisitorSaveSchema::visitStudyInNode(), YACS::ENGINE::VisitorSaveSalomeSchema::visitStudyInNode(), YACS::ENGINE::VisitorSaveSchema::visitStudyOutNode(), YACS::ENGINE::VisitorSaveSalomeSchema::visitStudyOutNode(), YACS::ENGINE::VisitorSaveSchema::visitSwitch(), YACS::ENGINE::VisitorSaveState::visitSwitch(), YACS::ENGINE::VisitorSaveSchema::visitWhileLoop(), YACS::ENGINE::VisitorSaveState::visitWhileLoop(), YACS::ENGINE::VisitorSaveSchema::writeControls(), YACS::ENGINE::VisitorSaveSchema::writeParametersNode(), YACS::HMI::VisitorSaveGuiSchema::writePresentation(), YACS::ENGINE::VisitorSaveSchema::writeSimpleDataLinks(), and YACS::ENGINE::VisitorSaveSchema::writeSimpleStreamLinks().

◆ getDelegateOf() [1/2]

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

Reimplemented in YACS::ENGINE::Loop.

Definition at line 1472 of file ComposedNode.cxx.

1473 {
1474 }

Referenced by YACS::ENGINE::OutPort::calculateHistoryOfLinkWith(), and edRemoveLink().

◆ getDelegateOf() [2/2]

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

Reimplemented in YACS::ENGINE::Switch, YACS::ENGINE::Loop, and YACS::ENGINE::ForEachLoopGen.

Definition at line 1476 of file ComposedNode.cxx.

1477 {
1478 }

◆ getDeploymentTree()

DeploymentTree ComposedNode::getDeploymentTree ( ) const
virtual

Essentially for test. Use checkDeploymentTree instead to be sure that returned DeploymentTree is consistent.

Implements YACS::ENGINE::Scheduler.

Definition at line 176 of file ComposedNode.cxx.

177 {
178  DeploymentTree ret;
179  list< ElementaryNode * > tasks=getRecursiveConstituents();
180  for(list< ElementaryNode * >::iterator iter=tasks.begin();iter!=tasks.end();iter++)
181  ret.appendTask(*iter,(*iter)->getDynClonerIfExists(this));
182  return ret;
183 }

References YACS::ENGINE::DeploymentTree::appendTask(), and getRecursiveConstituents().

Referenced by performDuplicationOfPlacement(), performShallowDuplicationOfPlacement(), and YACS::ENGINE::Proc::updateContainersAndComponents().

◆ getErrorReport()

std::string ComposedNode::getErrorReport ( )
virtual

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

Reimplemented from YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::DynParaLoop.

Definition at line 1561 of file ComposedNode.cxx.

1562 {
1563  DEBTRACE("ComposedNode::getErrorReport: " << getName() << " " << _state);
1564  YACS::StatesForNode effectiveState=getEffectiveState();
1565 
1566  if(effectiveState != YACS::INVALID && effectiveState != YACS::ERROR && effectiveState != YACS::FAILED)
1567  return "";
1568 
1569  std::string report="<error node= " + getName();
1570  switch(effectiveState)
1571  {
1572  case YACS::INVALID:
1573  report=report+" state= INVALID";
1574  break;
1575  case YACS::ERROR:
1576  report=report+" state= ERROR";
1577  break;
1578  case YACS::FAILED:
1579  report=report+" state= FAILED";
1580  break;
1581  default:
1582  break;
1583  }
1584  report=report + ">\n" ;
1585  if(_errorDetails != "")
1586  report=report+_errorDetails+"\n";
1587 
1588  list<Node *> constituents=edGetDirectDescendants();
1589  for(list<Node *>::iterator iter=constituents.begin(); iter!=constituents.end(); iter++)
1590  {
1591  std::string rep=(*iter)->getErrorReport();
1592  if(rep != "")
1593  {
1594  report=report+rep+"\n";
1595  }
1596  }
1597  report=report+"</error>";
1598  return report;
1599 }
virtual YACS::StatesForNode getEffectiveState() const
Return the node state in the context of its father.
Definition: Node.cxx:538
@ FAILED
Definition: define.hxx:51
@ ERROR
Definition: define.hxx:52

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

Referenced by main(), and YACS::HMI::EditionProc::synchronize().

◆ getInPortName()

string ComposedNode::getInPortName ( const InPort inPort) const
virtual

Get the input port name.

get the input port name used by the current node, recursively built with children names.

Implements YACS::ENGINE::Node.

Definition at line 1200 of file ComposedNode.cxx.

1201 {
1202  return getPortName<InPort>(inPort);
1203 }

Referenced by YACS::ENGINE::LinkInfo::getErrRepr(), YACS::ENGINE::LinkInfo::getInfoRepr(), YACS::ENGINE::LinkInfo::getWarnRepr(), and YACS::ENGINE::DynParaLoop::prepareInputsFromOutOfScope().

◆ getInputDataStreamPort()

InputDataStreamPort * ComposedNode::getInputDataStreamPort ( const std::string &  name) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 1337 of file ComposedNode.cxx.

1338 {
1339  string portName, nodeName;
1340  if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,true))
1341  {
1342  Node *child = getChildByName(nodeName);
1343  return child->getInputDataStreamPort(portName);
1344  }
1345  else
1346  {
1347  string what("ComposedNode::getInputDataStreamPort : the port with name "); what+=name; what+=" does not exist on the current level";
1348  throw Exception(what);
1349  }
1350 }
Node * getChildByName(const std::string &name) const
virtual InputDataStreamPort * getInputDataStreamPort(const std::string &name) const =0
static const char SEP_CHAR_IN_PORT[]
Definition: Node.hxx:94

References getChildByName(), YACS::ENGINE::Node::getInputDataStreamPort(), YACS::ENGINE::Node::SEP_CHAR_IN_PORT, and splitNamesBySep().

◆ getInputPort()

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

Reimplemented in YACS::ENGINE::WhileLoop, YACS::ENGINE::Switch, YACS::ENGINE::OptimizerLoop, YACS::ENGINE::ForLoop, YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::DynParaLoop.

Definition at line 1297 of file ComposedNode.cxx.

1298 {
1299  try {
1300  return Node::getInputPort(name);
1301  }
1302  catch(Exception& e) {}
1303 
1304  string portName, nodeName;
1305  if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,true))
1306  {
1307  Node *child = getChildByName(nodeName);
1308  return child->getInputPort(portName);
1309  }
1310  else
1311  {
1312  string what("ComposedNode::getInputPort : the port with name "); what+=name; what+=" does not exist on the current level";
1313  throw Exception(what);
1314  }
1315 }
virtual InputPort * getInputPort(const std::string &name) const
Definition: Node.cxx:260

References getChildByName(), YACS::ENGINE::Node::getInputPort(), YACS::ENGINE::Node::SEP_CHAR_IN_PORT, and splitNamesBySep().

Referenced by YACS::ENGINE::DynParaLoop::getInputPort(), YACS::ENGINE::ForLoop::getInputPort(), YACS::ENGINE::Switch::getInputPort(), and YACS::ENGINE::WhileLoop::getInputPort().

◆ getLocalInputPorts()

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

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

Implements YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::WhileLoop, YACS::ENGINE::Switch, YACS::ENGINE::OptimizerLoop, YACS::ENGINE::ForLoop, YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::DynParaLoop.

Definition at line 1516 of file ComposedNode.cxx.

1517 {
1518  std::list<InputPort *> lip; return lip; // empty list
1519 }

Referenced by checkBasicConsistency(), YACS::ENGINE::DynParaLoop::getLocalInputPorts(), YACS::ENGINE::Switch::getLocalInputPorts(), and YACS::HMI::SubjectComposedNode::loadChildren().

◆ getLocalOutputPorts()

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

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

Implements YACS::ENGINE::Node.

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

Definition at line 1522 of file ComposedNode.cxx.

1523 {
1524  std::list<OutputPort *> lop; return lop; // empty list
1525 }

Referenced by YACS::ENGINE::DynParaLoop::getLocalOutputPorts(), and YACS::HMI::SubjectComposedNode::loadChildren().

◆ getLowestCommonAncestor()

ComposedNode * ComposedNode::getLowestCommonAncestor ( Node node1,
Node node2 
)
static

Retrieves the lowest common ancestor of 2 nodes.

Note
Retrieves the lowest common ancestor of 'node1' AND 'node2'. If 'node1' or 'node2' are both or indiscriminately instances of ComposedNode and that 'node1' is in descendance of 'node2' (resp. 'node2' in descendance of 'node1') 'node2' is returned (resp. 'node1').
Exceptions
Exception: if 'node1' and 'node2' do not share the same genealogy.
Returns
The lowest common ancestor if it exists.

Definition at line 1050 of file ComposedNode.cxx.

1051 {
1052  const char what[]="The two nodes do not share the same genealogy";
1053  if(node1==0 || node2==0)
1054  throw Exception(what);
1055  ComposedNode *temp;
1056  if(dynamic_cast<ComposedNode *>(node1))
1057  temp=(ComposedNode *)node1;//->_father;
1058  else
1059  temp=(ComposedNode *)node1->_father;
1060  set<ComposedNode *> s;
1061  while(temp)
1062  {
1063  s.insert(temp);
1064  temp=temp->_father;
1065  }
1066  //
1067  if(dynamic_cast<ComposedNode *>(node2))
1068  temp=(ComposedNode *)node2;//->_father;
1069  else
1070  temp=(ComposedNode *)node2->_father;
1071  set<ComposedNode *>::iterator iter=s.find(temp);
1072  while(temp && iter==s.end())
1073  {
1074  iter=s.find(temp);
1075  temp=temp->_father;
1076  }
1077  if(iter==s.end())
1078  throw Exception(what);
1079  return *iter;
1080 }

References YACS::ENGINE::Node::_father, testCppPluginInvokation::node1, and testCppPluginInvokation::node2.

Referenced by YACS::ENGINE::Bloc::Bloc(), YACS::ENGINE::OutPort::calculateHistoryOfLinkWith(), checkConsistency(), checkLinksCoherenceRegardingControl(), edAddDFLink(), edAddLink(), edRemoveLink(), and YACS::ENGINE::ForEachLoopGen::getFEDeltaBetween().

◆ getLowestCommonAncestorStr()

std::string ComposedNode::getLowestCommonAncestorStr ( const std::string &  node1,
const std::string &  node2 
)
static

Same as getLowestCommonAncestor method except that absolute string representation is considered here instead of instances.

Definition at line 1085 of file ComposedNode.cxx.

1086 {
1087  std::string ret;
1088  std::size_t it1_b(0),it1_e(0),it2_b(0),it2_e(0);
1089  while(it1_b!=std::string::npos && it2_b!=std::string::npos)
1090  {
1091  it1_e=node1.find(SEP_CHAR_BTW_LEVEL,it1_b);
1092  it2_e=node2.find(SEP_CHAR_BTW_LEVEL,it2_b);
1093  if(it1_e!=it2_e && it1_e!=std::string::npos && it2_e!=std::string::npos)
1094  break;
1095  std::string elt1(node1.substr(it1_b,it1_e-it1_b)),elt2(node2.substr(it2_b,it2_e-it2_b));
1096  if(elt1!=elt2)
1097  break;
1098  if(!ret.empty())
1099  ret+=SEP_CHAR_BTW_LEVEL;
1100  ret+=elt1;
1101  it1_b=node1.find_first_not_of(SEP_CHAR_BTW_LEVEL,it1_e);
1102  it2_b=node2.find_first_not_of(SEP_CHAR_BTW_LEVEL,it2_e);
1103  }
1104  return ret;
1105 }

References testCppPluginInvokation::node1, testCppPluginInvokation::node2, and SEP_CHAR_BTW_LEVEL.

◆ getLowestNodeDealingAll()

Node * ComposedNode::getLowestNodeDealingAll ( const std::list< OutPort * > &  ports) const
protected

Returns the lowest Node (Elementary or Composed) (is sense of hierachy level ( operator< ) ) containing all 'ports'. Typically use in consistency computation. Precondition : 'ports' must contain at least one element. All elements of 'ports' should be in descendance of 'this'.

Definition at line 700 of file ComposedNode.cxx.

701 {
702  list< OutPort *>::const_iterator iter=ports.begin();
703  Node *ret=(*iter)->getNode();
704  iter++;
705  for(;iter!=ports.end();iter++)
706  {
707  Node *tmp=(*iter)->getNode();
708  if(*tmp>*ret)
709  ret=tmp;
710  }
711  return ret;
712 }

Referenced by solveObviousOrDelegateCFLinks().

◆ getMyQualifiedName()

std::string ComposedNode::getMyQualifiedName ( const Node directSon) const
virtual

Reimplemented in YACS::ENGINE::Switch.

Definition at line 994 of file ComposedNode.cxx.

995 {
996  return directSon->getName();
997 }

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

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

◆ getName()

std::string ComposedNode::getName ( ) const
virtual

Implements YACS::ENGINE::Scheduler.

Definition at line 165 of file ComposedNode.cxx.

166 {
167  return Node::getName();
168 }

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

Referenced by YACS::HMI::SceneBlocItem::arrangeChildNodes(), YACS::ENGINE::OptimizerLoop::checkTypeCode(), YACS::ENGINE::DynParaLoop::cloneAndPlaceNodesCoherently(), YACS::ENGINE::CppNode::cloneNode(), YACS::ENGINE::PythonNode::cloneNode(), YACS::ENGINE::PyFuncNode::cloneNode(), YACS::ENGINE::SalomePythonNode::cloneNode(), YACS::ENGINE::CollectorSwOutPort::CollectorSwOutPort(), YACS::HMI::SubjectNode::copy(), YACS::HMI::Subject::destroy(), YACS::ENGINE::DFToDSForLoop::DFToDSForLoop(), YACS::ENGINE::DSToDFForLoop::DSToDFForLoop(), edAddDFLink(), edRemoveChild(), YACS::ENGINE::CORBANode::execute(), YACS::ENGINE::SalomeNode::execute(), YACS::ENGINE::DistributedPythonNode::execute(), YACS::ENGINE::SalomePythonNode::execute(), YACS::ENGINE::XmlNode::execute(), YACS::ENGINE::PythonNode::executeLocal(), YACS::ENGINE::PyFuncNode::executeLocal(), YACS::ENGINE::PythonNode::executeRemote(), YACS::ENGINE::PyFuncNode::executeRemote(), YACS::ENGINE::ForEachLoopGen::exUpdateState(), YACS::ENGINE::ForLoop::exUpdateState(), YACS::ENGINE::Switch::getCaseId(), YACS::ENGINE::DynParaLoop::getChildByNameExec(), YACS::ENGINE::Bloc::getChildByShortName(), YACS::ENGINE::DynParaLoop::getChildByShortName(), YACS::ENGINE::Loop::getChildByShortName(), YACS::ENGINE::Switch::getChildByShortName(), getChildName(), YACS::ENGINE::Switch::getDelegateOf(), getErrorReport(), YACS::ENGINE::DynParaLoop::getErrorReport(), YACS::ENGINE::Node::getId(), YACS::ENGINE::SalomePythonNode::load(), YACS::ENGINE::ProcCataLoader::loadCata(), YACS::ENGINE::PyFuncNode::loadLocal(), YACS::HMI::CommandReparentNode::localExecute(), YACS::HMI::CommandPutInComposedNode::localExecute(), YACS::HMI::CommandCopyNode::localExecute(), YACS::HMI::CommandRenameNode::localExecute(), YACS::HMI::CommandRenameInDataPort::localExecute(), YACS::HMI::CommandRenameOutDataPort::localExecute(), YACS::HMI::CommandAddLink::localExecute(), YACS::HMI::CommandAddControlLink::localExecute(), YACS::HMI::CommandAssociateServiceToComponent::localExecute(), YACS::HMI::CommandReparentNode::localReverse(), YACS::HMI::CommandPutInComposedNode::localReverse(), YACS::HMI::CommandCopyNode::localReverse(), YACS::HMI::CommandRenameNode::localReverse(), YACS::HMI::CommandRenameInDataPort::localReverse(), YACS::HMI::CommandRenameOutDataPort::localReverse(), YACS::HMI::CommandAssociateServiceToComponent::localReverse(), YACS::HMI::SubjectNode::registerUndoDestroy(), YACS::HMI::SubjectNode::reparent(), YACS::ENGINE::Node::setName(), YACS::ENGINE::PythonNode::squeezeMemory(), YACS::ENGINE::PythonNode::squeezeMemoryRemote(), YACS::switchtypeParser::state(), YACS::HMI::SubjectControlLink::SubjectControlLink(), YACS::HMI::SubjectLink::SubjectLink(), YACS::ENGINE::VisitorSaveSchema::visitBloc(), YACS::ENGINE::VisitorSaveState::visitBloc(), YACS::ENGINE::VisitorSalomeSaveState::visitForEachLoop(), YACS::ENGINE::VisitorSaveSchema::visitForEachLoop(), YACS::ENGINE::VisitorSaveState::visitForEachLoop(), YACS::ENGINE::VisitorSaveSchema::visitForEachLoopDyn(), YACS::ENGINE::VisitorSaveState::visitForEachLoopDyn(), YACS::ENGINE::VisitorSaveSchema::visitForLoop(), YACS::ENGINE::VisitorSaveState::visitForLoop(), YACS::ENGINE::VisitorSaveState::visitLoop(), YACS::ENGINE::VisitorSaveSchema::visitOptimizerLoop(), YACS::ENGINE::VisitorSaveState::visitOptimizerLoop(), YACS::ENGINE::VisitorSaveSchema::visitProc(), YACS::ENGINE::VisitorSaveState::visitProc(), YACS::ENGINE::VisitorSaveSchema::visitSwitch(), YACS::ENGINE::VisitorSaveState::visitSwitch(), YACS::ENGINE::VisitorSaveSchema::visitWhileLoop(), YACS::ENGINE::VisitorSaveState::visitWhileLoop(), YACS::ENGINE::ForEachLoopGen::writeDot(), and YACS::ENGINE::VisitorSaveSchema::writeSimpleDataLinks().

◆ getNextTasks()

std::vector< Task * > ComposedNode::getNextTasks ( bool &  isMore)
virtual

Implements YACS::ENGINE::Scheduler.

Definition at line 217 of file ComposedNode.cxx.

218 {
219  vector<Task *> ret;
220  isMore=false;
221  getReadyTasks(ret);
222  isMore=!ret.empty();
223  return ret;
224 }
virtual void getReadyTasks(std::vector< Task * > &tasks)=0

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

◆ getNumberOfInputPorts()

int ComposedNode::getNumberOfInputPorts ( ) const
virtual

Implements YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::Switch, YACS::ENGINE::OptimizerLoop, YACS::ENGINE::Loop, YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::DynParaLoop.

Definition at line 1210 of file ComposedNode.cxx.

1211 {
1212  list<Node *> constituents=edGetDirectDescendants();
1213  int ret=0;
1214  for(list<Node *>::iterator iter=constituents.begin();iter!=constituents.end();iter++)
1215  ret+=(*iter)->getNumberOfInputPorts();
1216  return ret;
1217 }

References edGetDirectDescendants().

Referenced by YACS::ENGINE::DynParaLoop::getNumberOfInputPorts(), YACS::ENGINE::Loop::getNumberOfInputPorts(), and YACS::ENGINE::Switch::getNumberOfInputPorts().

◆ getNumberOfOutputPorts()

int ComposedNode::getNumberOfOutputPorts ( ) const
virtual

Implements YACS::ENGINE::Node.

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

Definition at line 1219 of file ComposedNode.cxx.

1220 {
1221  list<Node *> constituents=edGetDirectDescendants();
1222  int ret=0;
1223  for(list<Node *>::iterator iter=constituents.begin();iter!=constituents.end();iter++)
1224  ret+=(*iter)->getNumberOfOutputPorts();
1225  return ret;
1226 }

References edGetDirectDescendants().

Referenced by YACS::ENGINE::DynParaLoop::getNumberOfOutputPorts().

◆ getOutPort()

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

Reimplemented in YACS::ENGINE::Switch, YACS::ENGINE::OptimizerLoop, YACS::ENGINE::ForLoop, YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::DynParaLoop.

Definition at line 1276 of file ComposedNode.cxx.

1277 {
1278  string portName, nodeName;
1279  if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,false))
1280  {
1281  Node *child = getChildByShortName(nodeName);
1282  return child->getOutPort(portName);
1283  }
1284  else
1285  {
1286  string what("ComposedNode::getOutPort : the port with name "); what+=name; what+=" does not exist on the current level";
1287  throw Exception(what);
1288  }
1289 }
virtual OutPort * getOutPort(const std::string &name) const
Definition: Node.cxx:275

References getChildByShortName(), YACS::ENGINE::Node::getOutPort(), YACS::ENGINE::Node::SEP_CHAR_IN_PORT, and splitNamesBySep().

Referenced by YACS::ENGINE::Bloc::Bloc(), YACS::ENGINE::DynParaLoop::getOutPort(), YACS::ENGINE::ForLoop::getOutPort(), YACS::ENGINE::Switch::getOutPort(), and YACS::ENGINE::WhileLoop::WhileLoop().

◆ getOutPortName()

◆ getOutputDataStreamPort()

OutputDataStreamPort * ComposedNode::getOutputDataStreamPort ( const std::string &  name) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 1352 of file ComposedNode.cxx.

1353 {
1354  string portName, nodeName;
1355  if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,true))
1356  {
1357  Node *child = getChildByName(nodeName);
1358  return child->getOutputDataStreamPort(portName);
1359  }
1360  else
1361  {
1362  string what("ComposedNode::getOutputDataStreamPort : the port with name "); what+=name; what+=" does not exist on the current level";
1363  throw Exception(what);
1364  }
1365 }
virtual OutputDataStreamPort * getOutputDataStreamPort(const std::string &name) const =0

References getChildByName(), YACS::ENGINE::Node::getOutputDataStreamPort(), YACS::ENGINE::Node::SEP_CHAR_IN_PORT, and splitNamesBySep().

◆ getOutputPort()

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

Implements YACS::ENGINE::Node.

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

Definition at line 1322 of file ComposedNode.cxx.

1323 {
1324  string portName, nodeName;
1325  if(splitNamesBySep(name,Node::SEP_CHAR_IN_PORT,nodeName,portName,false))
1326  {
1327  Node *child = getChildByShortName(nodeName);
1328  return child->getOutputPort(portName);
1329  }
1330  else
1331  {
1332  string what("ComposedNode::getOutputPort : the port with name "); what+=name; what+=" does not exist on the current level";
1333  throw Exception(what);
1334  }
1335 }
virtual OutputPort * getOutputPort(const std::string &name) const =0

References getChildByShortName(), YACS::ENGINE::Node::getOutputPort(), YACS::ENGINE::Node::SEP_CHAR_IN_PORT, and splitNamesBySep().

Referenced by YACS::ENGINE::DynParaLoop::getOutputPort(), and YACS::ENGINE::ForLoop::getOutputPort().

◆ getPortName()

template<class PORT >
std::string YACS::ENGINE::ComposedNode::getPortName ( const PORT *  port) const
protected

Definition at line 180 of file ComposedNode.hxx.

181  {
182  Node *node = port->getNode();
183  std::string portName = port->getName();
184  checkInMyDescendance(node);
185  Node *father = node;
186  while (father != this)
187  {
188  portName = father->getQualifiedName() + Node::SEP_CHAR_IN_PORT + portName;
189  father = father->_father;
190  }
191  return portName;
192  }

References YACS::ENGINE::Node::_father, checkInMyDescendance(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Node::getQualifiedName(), and YACS::ENGINE::Node::SEP_CHAR_IN_PORT.

Referenced by YACS::ENGINE::Bloc::Bloc(), YACS::ENGINE::ForEachLoopGen::buildDelegateOf(), YACS::ENGINE::DynParaLoop::DynParaLoop(), YACS::ENGINE::ForLoop::ForLoop(), YACS::ENGINE::ForEachLoopGen::getOutputPortType(), YACS::ENGINE::OptimizerLoop::OptimizerLoop(), YACS::ENGINE::DynParaLoop::putValueOnBranch(), and YACS::ENGINE::WhileLoop::WhileLoop().

◆ getProgress()

virtual std::string YACS::ENGINE::ComposedNode::getProgress ( ) const
inlinevirtual

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

Definition at line 126 of file ComposedNode.hxx.

126 { return "0"; }

◆ getProgressWeight()

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

Get the progress weight for all elementary nodes.

Only elementary nodes have weight. A simple composed node only sum up weight of all his descendants (working is different for loop or switch nodes)

Implements YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::Switch, YACS::ENGINE::ForLoop, and YACS::ENGINE::ForEachLoopGen.

Definition at line 1183 of file ComposedNode.cxx.

1184 {
1185  list<ProgressWeight> ret;
1186  list<Node *> setOfNode=edGetDirectDescendants();
1187  for(list<Node *>::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1188  {
1189  list<ProgressWeight> myCurrentSet=((ComposedNode*)(*iter))->getProgressWeight();
1190  ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
1191  }
1192  return ret;
1193 }
std::list< ProgressWeight > getProgressWeight() const
Get the progress weight for all elementary nodes.

References edGetDirectDescendants().

Referenced by YACS::ENGINE::Proc::getGlobalProgressPercent().

◆ getProperty()

std::string ComposedNode::getProperty ( const std::string &  name)
overridevirtual

Reimplemented from YACS::ENGINE::Node.

Definition at line 1509 of file ComposedNode.cxx.

1510 {
1511  return Node::getProperty(name);
1512 }
virtual std::string getProperty(const std::string &name)
Definition: Node.cxx:497

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

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

◆ getRecursiveConstituents()

list< ElementaryNode * > ComposedNode::getRecursiveConstituents ( ) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 1121 of file ComposedNode.cxx.

1122 {
1123  list<ElementaryNode *> ret;
1124  list<Node *> setOfNode=edGetDirectDescendants();
1125  for(list<Node *>::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1126  {
1127  list<ElementaryNode *> myCurrentSet=(*iter)->getRecursiveConstituents();
1128  ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
1129  }
1130  return ret;
1131 }

References edGetDirectDescendants().

Referenced by checkDeploymentTree(), getDeploymentTree(), performDuplicationOfPlacement(), and performShallowDuplicationOfPlacement().

◆ getRootNode()

ComposedNode * ComposedNode::getRootNode ( ) const
virtual

Reimplemented from YACS::ENGINE::Node.

Definition at line 927 of file ComposedNode.cxx.

928 {
929  if(!_father)
930  return (ComposedNode *)this;
931  return Node::getRootNode();
932 }
virtual ComposedNode * getRootNode() const
Definition: Node.cxx:431

References YACS::ENGINE::Node::_father, and YACS::ENGINE::Node::getRootNode().

◆ getSetOfInputDataStreamPort()

list< InputDataStreamPort * > ComposedNode::getSetOfInputDataStreamPort ( ) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 1252 of file ComposedNode.cxx.

1253 {
1254  list<Node *> constituents=edGetDirectDescendants();
1255  list<InputDataStreamPort *> ret;
1256  for(list<Node *>::iterator iter=constituents.begin();iter!=constituents.end();iter++)
1257  {
1258  list<InputDataStreamPort *> currentsPorts=(*iter)->getSetOfInputDataStreamPort();
1259  ret.insert(ret.end(),currentsPorts.begin(),currentsPorts.end());
1260  }
1261  return ret;
1262 }

References edGetDirectDescendants().

Referenced by YACS::HMI::SubjectComposedNode::loadChildren().

◆ getSetOfInputPort()

list< InputPort * > ComposedNode::getSetOfInputPort ( ) const
virtual

Implements YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::Switch, YACS::ENGINE::OptimizerLoop, YACS::ENGINE::Loop, YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::DynParaLoop.

Definition at line 1228 of file ComposedNode.cxx.

1229 {
1230  list<Node *> constituents=edGetDirectDescendants();
1231  list<InputPort *> ret;
1232  for(list<Node *>::iterator iter=constituents.begin();iter!=constituents.end();iter++)
1233  {
1234  list<InputPort *> currentsPorts=(*iter)->getSetOfInputPort();
1235  ret.insert(ret.end(),currentsPorts.begin(),currentsPorts.end());
1236  }
1237  return ret;
1238 }

References edGetDirectDescendants().

Referenced by checkConsistency(), YACS::ENGINE::DynParaLoop::getSetOfInputPort(), YACS::ENGINE::Loop::getSetOfInputPort(), and YACS::ENGINE::Switch::getSetOfInputPort().

◆ getSetOfInternalLinks()

std::vector< std::pair< OutPort *, InPort * > > ComposedNode::getSetOfInternalLinks ( ) const

Definition at line 587 of file ComposedNode.cxx.

588 {
589  vector< pair<OutPort *, InPort *> > ret;
590  list<OutPort *> temp=getSetOfOutPort();
591  for(list<OutPort *>::const_iterator iter2=temp.begin();iter2!=temp.end();iter2++)
592  {
593  set<InPort *> temp2=(*iter2)->edSetInPort();
594  for(set<InPort *>::iterator iter3=temp2.begin();iter3!=temp2.end();iter3++)
595  if(isInMyDescendance((*iter3)->getNode()))
596  ret.push_back(pair<OutPort *, InPort *>((*iter2),(*iter3)));
597  }
598  return ret;
599 }

References YACS::ENGINE::Node::getSetOfOutPort(), and isInMyDescendance().

Referenced by YACS::ENGINE::Bloc::Bloc(), YACS::ENGINE::ForLoop::ForLoop(), YACS::HMI::SubjectComposedNode::loadLinks(), and YACS::ENGINE::WhileLoop::WhileLoop().

◆ getSetOfLinksComingInCurrentScope()

std::vector< std::pair< InPort *, OutPort * > > ComposedNode::getSetOfLinksComingInCurrentScope ( ) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 835 of file ComposedNode.cxx.

836 {
837  vector< pair<InPort *, OutPort *> > ret;
838  set<InPort *> ports=getAllInPortsComingFromOutsideOfCurrentScope();
839  for(set<InPort *>::iterator iter2=ports.begin();iter2!=ports.end();iter2++)
840  {
841  set<OutPort *> temp2=(*iter2)->edSetOutPort();
842  for(set<OutPort *>::iterator iter3=temp2.begin();iter3!=temp2.end();iter3++)
843  {
844  if(isInMyDescendance((*iter3)->getNode()))continue;
845  std::set<OutPort *> trueOutPorts;
846  (*iter3)->getAllRepresented(trueOutPorts);
847  for(std::set<OutPort *>::iterator iter4=trueOutPorts.begin();iter4!=trueOutPorts.end();++iter4)
848  ret.push_back(pair<InPort *, OutPort *>(*iter2,*iter4));
849  }
850  }
851  return ret;
852 }
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope() const
List all input ports that are linked to out of scope ports.

References getAllInPortsComingFromOutsideOfCurrentScope(), and isInMyDescendance().

Referenced by edDisconnectAllLinksWithMe().

◆ getSetOfLinksLeavingCurrentScope()

std::vector< std::pair< OutPort *, InPort * > > ComposedNode::getSetOfLinksLeavingCurrentScope ( ) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 601 of file ComposedNode.cxx.

602 {
603  vector< pair<OutPort *, InPort *> > ret;
604  std::set<OutPort *> ports=getAllOutPortsLeavingCurrentScope();
605  for(set<OutPort *>::iterator iter2=ports.begin();iter2!=ports.end();iter2++)
606  {
607  set<InPort *> temp2=(*iter2)->edSetInPort();
608  for(set<InPort *>::iterator iter3=temp2.begin();iter3!=temp2.end();iter3++)
609  if(!isInMyDescendance((*iter3)->getNode()))
610  ret.push_back(pair<OutPort *, InPort *>(*iter2,*iter3));
611  }
612  return ret;
613 }
std::set< OutPort * > getAllOutPortsLeavingCurrentScope() const
List all output ports of children nodes that are linked to out of scope input ports.

References getAllOutPortsLeavingCurrentScope(), and isInMyDescendance().

Referenced by edDisconnectAllLinksWithMe().

◆ getSetOfOutputDataStreamPort()

list< OutputDataStreamPort * > ComposedNode::getSetOfOutputDataStreamPort ( ) const
virtual

Implements YACS::ENGINE::Node.

Definition at line 1264 of file ComposedNode.cxx.

1265 {
1266  list<Node *> constituents=edGetDirectDescendants();
1267  list<OutputDataStreamPort *> ret;
1268  for(list<Node *>::iterator iter=constituents.begin();iter!=constituents.end();iter++)
1269  {
1270  list<OutputDataStreamPort *> currentsPorts=(*iter)->getSetOfOutputDataStreamPort();
1271  ret.insert(ret.end(),currentsPorts.begin(),currentsPorts.end());
1272  }
1273  return ret;
1274 }

References edGetDirectDescendants().

Referenced by YACS::HMI::SubjectComposedNode::loadChildren().

◆ getSetOfOutputPort()

list< OutputPort * > ComposedNode::getSetOfOutputPort ( ) const
virtual

Implements YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::OptimizerLoop, YACS::ENGINE::ForLoop, and YACS::ENGINE::DynParaLoop.

Definition at line 1240 of file ComposedNode.cxx.

1241 {
1242  list<Node *> constituents=edGetDirectDescendants();
1243  list<OutputPort *> ret;
1244  for(list<Node *>::iterator iter=constituents.begin();iter!=constituents.end();iter++)
1245  {
1246  list<OutputPort *> currentsPorts=(*iter)->getSetOfOutputPort();
1247  ret.insert(ret.end(),currentsPorts.begin(),currentsPorts.end());
1248  }
1249  return ret;
1250 }

References edGetDirectDescendants().

Referenced by YACS::ENGINE::DynParaLoop::getSetOfOutputPort(), and YACS::ENGINE::ForLoop::getSetOfOutputPort().

◆ getTaskName()

std::string ComposedNode::getTaskName ( Task task) const
virtual

Implements YACS::ENGINE::Scheduler.

Definition at line 170 of file ComposedNode.cxx.

171 {
172  return getChildName(dynamic_cast<ElementaryNode *>(task));
173 }
std::string getChildName(const Node *node) const

References getChildName().

◆ init()

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

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

Reimplemented from YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::SalomeProc, YACS::ENGINE::WhileLoop, YACS::ENGINE::Switch, YACS::ENGINE::OptimizerLoop, YACS::ENGINE::Loop, YACS::ENGINE::ForLoop, YACS::ENGINE::ForEachLoopGen, and YACS::ENGINE::DynParaLoop.

Definition at line 160 of file ComposedNode.cxx.

161 {
162  Node::init(start);
163 }
virtual void init(bool start=true)
Definition: Node.cxx:102

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

Referenced by YACS::ENGINE::DynParaLoop::init(), YACS::ENGINE::Loop::init(), and YACS::ENGINE::Switch::init().

◆ isFinished()

bool ComposedNode::isFinished ( )
virtual

◆ isInMyDescendance()

Node * ComposedNode::isInMyDescendance ( Node nodeToTest) const

Returns the parent of a node that is the direct child of this node.

Note
if 'nodeToTest'=='this' this is returned. Else if 'nodeToTest' is in descendance of 'this' the direct son is returned. Else 0 is returned.
Parameters
nodeToTest: the node to check

Definition at line 949 of file ComposedNode.cxx.

950 {
951  if(nodeToTest==0)
952  return 0;
953  if((ComposedNode *)nodeToTest==this)
954  return (Node *)this;
955  Node *iterBack=nodeToTest;
956  ComposedNode *iter=nodeToTest->_father;
957  while(iter!=0 && iter!=this)
958  {
959  iterBack=iter;
960  iter=iter->_father;
961  }
962  if(iter!=0)
963  return iterBack;
964  else
965  return 0;
966 }

References YACS::ENGINE::Node::_father.

Referenced by YACS::ENGINE::DynParaLoop::buildDelegateOf(), YACS::ENGINE::Loop::buildDelegateOf(), YACS::ENGINE::Bloc::checkCFLinks(), checkCFLinks(), YACS::ENGINE::DynParaLoop::checkCFLinks(), YACS::ENGINE::ForLoop::checkCFLinks(), checkConsistency(), YACS::ENGINE::Bloc::checkControlDependancy(), YACS::ENGINE::DynParaLoop::checkLinkPossibility(), YACS::ENGINE::OptimizerLoop::checkLinkPossibility(), YACS::ENGINE::DynParaLoop::cloneAndPlaceNodesCoherently(), getAllInPortsComingFromOutsideOfCurrentScope(), YACS::ENGINE::Switch::getAllInPortsComingFromOutsideOfCurrentScope(), getAllOutPortsLeavingCurrentScope(), YACS::ENGINE::DynParaLoop::getDynInputPortByAbsName(), YACS::HMI::SceneBlocItem::getNodesInfo(), YACS::ENGINE::Switch::getRankOfNode(), getSetOfInternalLinks(), getSetOfLinksComingInCurrentScope(), getSetOfLinksLeavingCurrentScope(), YACS::ENGINE::OptimizerLoop::initInterceptors(), YACS::HMI::SubjectComposedNode::removeExternalControlLinks(), YACS::ENGINE::VisitorSaveSchema::writeControls(), YACS::ENGINE::VisitorSaveSchema::writeSimpleDataLinks(), and YACS::ENGINE::VisitorSaveSchema::writeSimpleStreamLinks().

◆ isLoop()

virtual bool YACS::ENGINE::ComposedNode::isLoop ( ) const
inlinevirtual

Reimplemented in YACS::ENGINE::Loop, and YACS::ENGINE::DynParaLoop.

Definition at line 79 of file ComposedNode.hxx.

79 { return false; }

Referenced by edAddLink().

◆ isNameAlreadyUsed()

bool ComposedNode::isNameAlreadyUsed ( const std::string &  name) const
virtual

Reimplemented in YACS::ENGINE::Bloc.

Definition at line 1527 of file ComposedNode.cxx.

1528 {
1529  return false;
1530 }

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

◆ isNodeAlreadyAggregated()

bool ComposedNode::isNodeAlreadyAggregated ( const Node node) const

Check that Node 'node' is already a direct son of this.

Definition at line 935 of file ComposedNode.cxx.

936 {
937  list<ComposedNode *> nodeAncestors = node->getAllAscendanceOf();
938  return find(nodeAncestors.begin(),nodeAncestors.end(),(ComposedNode *)this)!=nodeAncestors.end();
939 }

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

Referenced by YACS::ENGINE::Bloc::edAddChild(), and getChildName().

◆ isPlacementPredictableB4Run()

virtual bool YACS::ENGINE::ComposedNode::isPlacementPredictableB4Run ( ) const
pure virtual

◆ isRepeatedUnpredictablySeveralTimes()

virtual bool YACS::ENGINE::ComposedNode::isRepeatedUnpredictablySeveralTimes ( ) const
inlinevirtual

Reimplemented in YACS::ENGINE::Loop.

Definition at line 78 of file ComposedNode.hxx.

78 { return false; }

◆ loaded()

void ComposedNode::loaded ( )

Definition at line 1488 of file ComposedNode.cxx.

1489 {
1490 }

◆ notifyFrom()

void ComposedNode::notifyFrom ( const Task sender,
YACS::Event  event,
const Executor execInst 
)
virtual

Notify the node a task has emitted an event.

TO COMMENT MORE

Note
Runtime called method. Overloads the Scheduler::notifyFrom abstract method. Typically Called in Executor (in a parallel thread or not) by the Task 'task' to inform the scheduler that an event coded 'event' (in Executor static const var) happened. Contrary to updateStateFrom several levels may exist between 'sender' and 'this'.
Parameters
sender: task emitting event
event: event emitted

Called by Executor::functionForTaskExecution on YACS::FINISH event

Called by Executor::launchTask on YACS::START event

Calls ComposedNode::updateStateFrom to update state from task to root node

Implements YACS::ENGINE::Scheduler.

Definition at line 243 of file ComposedNode.cxx.

247 {
248  DEBTRACE("ComposedNode::notifyFrom " << event);
249  ElementaryNode *taskTyped=dynamic_cast<ElementaryNode *>((Task *)sender);
250  YACS::Event curEvent=event;
251  Node *lminus1LevelNode=taskTyped;
252  ComposedNode *curLevelNode=taskTyped->_father;
253  if(!curLevelNode)//Specific case of loop when 0 turn is specified without any enclosing bloc.
254  return ;
255  curEvent=curLevelNode->updateStateFrom(lminus1LevelNode,curEvent,execInst);
256  while(curEvent!=YACS::NOEVENT && curLevelNode!=this)
257  {
258  lminus1LevelNode=curLevelNode;
259  curLevelNode=curLevelNode->_father;
260  curEvent=curLevelNode->updateStateFrom(lminus1LevelNode,curEvent,execInst);
261  }
262 }
YACS::Event updateStateFrom(Node *node, YACS::Event event, const Executor *execInst)
Update node state on receiving event from a node.
Event
Definition: define.hxx:56
@ NOEVENT
Definition: define.hxx:57

References YACS::ENGINE::Node::_father, DEBTRACE, YACS::NOEVENT, and updateStateFrom().

◆ performCFComputations()

void ComposedNode::performCFComputations ( LinkInfo info) const
protectedvirtual

perform recursively all CF computations.

Reimplemented in YACS::ENGINE::Bloc.

Definition at line 678 of file ComposedNode.cxx.

679 {
680  list<Node *> nodes=edGetDirectDescendants();
681  for(list<Node *>::iterator iter=nodes.begin();iter!=nodes.end();iter++)
682  if(dynamic_cast<ComposedNode *>(*iter))
683  ((ComposedNode *)(*iter))->performCFComputations(info);
684 }

References edGetDirectDescendants().

Referenced by checkConsistency(), and YACS::ENGINE::Bloc::performCFComputations().

◆ performDuplicationOfPlacement()

void ComposedNode::performDuplicationOfPlacement ( const Node other)
protectedvirtual

performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute.

Implements YACS::ENGINE::Node.

Definition at line 66 of file ComposedNode.cxx.

67 {
68  const ComposedNode &otherC=*(dynamic_cast<const ComposedNode *>(&other));
69  DeploymentTree treeToDup=otherC.getDeploymentTree();
70  list< ElementaryNode * > clones=otherC.getRecursiveConstituents();
71  vector<Container *> conts=treeToDup.getAllContainers();
72  //iterate on all containers
73  for(vector<Container *>::iterator iterCt=conts.begin();iterCt!=conts.end();iterCt++)
74  {
75  vector<ComponentInstance *> comps=treeToDup.getComponentsLinkedToContainer(*iterCt);
76  Container *contCloned=0;
77  if((*iterCt))
78  contCloned=(*iterCt)->clone();
79 
80  //iterate on all component instances linked to the container
81  for(vector<ComponentInstance *>::iterator iterCp=comps.begin();iterCp!=comps.end();iterCp++)
82  {
83  vector<Task *> tasks=treeToDup.getTasksLinkedToComponent(*iterCp);
84  ComponentInstance *curCloned=(*iterCp)->clone();
85  curCloned->setContainer(contCloned);
86  for(vector<Task *>::iterator iterT=tasks.begin();iterT!=tasks.end();iterT++)
87  {
88  //No risk for static cast : appendTask called by ComposedNode.
89  list< ElementaryNode * >::iterator res=find(clones.begin(),clones.end(),(ElementaryNode *)(*iterT));
90  //No risk here to because called only on cloning process...
91  ServiceNode *nodeC=(ServiceNode *)getChildByName(otherC.getChildName(*res));
92  nodeC->setComponent(curCloned);
93  }
94  curCloned->decrRef();
95  }
96 
97  // iterate on all tasks linked to the container
98  vector<Task *> tasks=treeToDup.getTasksLinkedToContainer(*iterCt);
99  for(vector<Task *>::iterator iterT=tasks.begin();iterT!=tasks.end();iterT++)
100  {
101  std::list< ElementaryNode * >::iterator res=find(clones.begin(),clones.end(),(ElementaryNode *)(*iterT));
103  nodeC->setContainer(contCloned);
104  }
105 
106  // ended with current container
107  if(contCloned)
108  contCloned->decrRef();
109  }
110 }
Base class for all component instances.
virtual bool setContainer(Container *cont)
virtual ComponentInstance * clone() const =0
DeploymentTree getDeploymentTree() const
Essentially for test. Use checkDeploymentTree instead to be sure that returned DeploymentTree is cons...
virtual Container * clone() const =0
WARNING ! clone behaviour MUST be in coherence with what is returned by isAttachedOnCloning() method
std::vector< Task * > getTasksLinkedToComponent(ComponentInstance *comp) const
std::vector< ComponentInstance * > getComponentsLinkedToContainer(Container *cont) const
std::vector< Task * > getTasksLinkedToContainer(Container *cont) const
std::vector< Container * > getAllContainers() const
Class for calculation node (function) inlined (and executed) in the schema.
Definition: InlineNode.hxx:93
virtual void setContainer(Container *container)
Definition: InlineNode.cxx:105
Class for calculation node associated with a component service.
Definition: ServiceNode.hxx:35
virtual void setComponent(ComponentInstance *compo)
Associate an existing component instance to this service node AND check the consistency regarding the...

References YACS::ENGINE::ComponentInstance::clone(), YACS::ENGINE::Container::clone(), YACS::ENGINE::RefCounter::decrRef(), YACS::ENGINE::DeploymentTree::getAllContainers(), getChildByName(), getChildName(), YACS::ENGINE::DeploymentTree::getComponentsLinkedToContainer(), getDeploymentTree(), getRecursiveConstituents(), YACS::ENGINE::DeploymentTree::getTasksLinkedToComponent(), YACS::ENGINE::DeploymentTree::getTasksLinkedToContainer(), YACS::ENGINE::ServiceNode::setComponent(), YACS::ENGINE::ComponentInstance::setContainer(), and YACS::ENGINE::InlineNode::setContainer().

◆ performShallowDuplicationOfPlacement()

void ComposedNode::performShallowDuplicationOfPlacement ( const Node other)
protectedvirtual

performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning.

Implements YACS::ENGINE::Node.

Definition at line 112 of file ComposedNode.cxx.

113 {
114  const ComposedNode &otherC=*(dynamic_cast<const ComposedNode *>(&other));
115  DeploymentTree treeToDup=otherC.getDeploymentTree();
116  list< ElementaryNode * > clones=otherC.getRecursiveConstituents();
117  vector<Container *> conts=treeToDup.getAllContainers();
118  //iterate on all containers
119  for(vector<Container *>::iterator iterCt=conts.begin();iterCt!=conts.end();iterCt++)
120  {
121  vector<ComponentInstance *> comps=treeToDup.getComponentsLinkedToContainer(*iterCt);
122  Container *contCloned((*iterCt));
123 
124  //iterate on all component instances linked to the container
125  for(vector<ComponentInstance *>::iterator iterCp=comps.begin();iterCp!=comps.end();iterCp++)
126  {
127  vector<Task *> tasks=treeToDup.getTasksLinkedToComponent(*iterCp);
128  ComponentInstance *curCloned((*iterCp));
129  curCloned->setContainer(contCloned);
130  for(vector<Task *>::iterator iterT=tasks.begin();iterT!=tasks.end();iterT++)
131  {
132  //No risk for static cast : appendTask called by ComposedNode.
133  list< ElementaryNode * >::iterator res=find(clones.begin(),clones.end(),(ElementaryNode *)(*iterT));
134  //No risk here to because called only on cloning process...
135  ServiceNode *nodeC=(ServiceNode *)getChildByName(otherC.getChildName(*res));
136  nodeC->setComponent(curCloned);
137  }
138  }
139 
140  // iterate on all tasks linked to the container
141  vector<Task *> tasks=treeToDup.getTasksLinkedToContainer(*iterCt);
142  for(vector<Task *>::iterator iterT=tasks.begin();iterT!=tasks.end();iterT++)
143  {
144  std::list< ElementaryNode * >::iterator res=find(clones.begin(),clones.end(),(ElementaryNode *)(*iterT));
146  nodeC->setContainer(contCloned);
147  }
148  }
149 }

References YACS::ENGINE::DeploymentTree::getAllContainers(), getChildByName(), getChildName(), YACS::ENGINE::DeploymentTree::getComponentsLinkedToContainer(), getDeploymentTree(), getRecursiveConstituents(), YACS::ENGINE::DeploymentTree::getTasksLinkedToComponent(), YACS::ENGINE::DeploymentTree::getTasksLinkedToContainer(), YACS::ENGINE::ServiceNode::setComponent(), YACS::ENGINE::ComponentInstance::setContainer(), and YACS::ENGINE::InlineNode::setContainer().

◆ releaseDelegateOf() [1/2]

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

Reimplemented in YACS::ENGINE::Loop.

Definition at line 1480 of file ComposedNode.cxx.

1481 {
1482 }

Referenced by edRemoveLink().

◆ releaseDelegateOf() [2/2]

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

Reimplemented in YACS::ENGINE::Switch, YACS::ENGINE::Loop, and YACS::ENGINE::ForEachLoopGen.

Definition at line 1484 of file ComposedNode.cxx.

1485 {
1486 }

◆ removeRecursivelyRedundantCL()

void ComposedNode::removeRecursivelyRedundantCL ( )
virtual

This method recursively all redundant control links in this.

Reimplemented in YACS::ENGINE::Bloc.

Definition at line 1110 of file ComposedNode.cxx.

1111 {
1112  std::list<Node *> dd(edGetDirectDescendants());
1113  for(std::list<Node *>::const_iterator it=dd.begin();it!=dd.end();it++)
1114  {
1115  ComposedNode *elt(dynamic_cast<ComposedNode *>(*it));
1116  if(elt)
1117  elt->removeRecursivelyRedundantCL();
1118  }
1119 }

References edGetDirectDescendants(), and removeRecursivelyRedundantCL().

Referenced by YACS::ENGINE::Bloc::removeRecursivelyRedundantCL(), and removeRecursivelyRedundantCL().

◆ resetState()

void ComposedNode::resetState ( int  level)
virtual

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

Reimplemented from YACS::ENGINE::Node.

Reimplemented in YACS::ENGINE::ForEachLoopGen.

Definition at line 1638 of file ComposedNode.cxx.

1639 {
1640  if(level==0)return;
1641 
1642  DEBTRACE("ComposedNode::resetState " << level << "," << _state);
1644  {
1645  Node::resetState(level);
1646  std::list<Node *> nodes=edGetDirectDescendants();
1647  for(std::list<Node *>::iterator iter=nodes.begin();iter!=nodes.end();iter++)
1648  (*iter)->resetState(level);
1649  }
1650 }
virtual void resetState(int level)
Reset the node state depending on the parameter level.
Definition: Node.cxx:851
@ ACTIVATED
Definition: define.hxx:41

References YACS::ENGINE::Node::_state, YACS::ACTIVATED, DEBTRACE, edGetDirectDescendants(), YACS::ERROR, YACS::FAILED, and YACS::ENGINE::Node::resetState().

Referenced by main(), and YACS::ENGINE::ForEachLoopGen::resetState().

◆ setProperty()

void ComposedNode::setProperty ( const std::string &  name,
const std::string &  value 
)
overridevirtual

Reimplemented from YACS::ENGINE::Node.

Definition at line 1504 of file ComposedNode.cxx.

1505 {
1506  Node::setProperty(name, value);
1507 }
virtual void setProperty(const std::string &name, const std::string &value)
Definition: Node.cxx:491

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

◆ shutdown()

void ComposedNode::shutdown ( int  level)
virtual

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

Reimplemented in YACS::ENGINE::DynParaLoop.

Definition at line 1616 of file ComposedNode.cxx.

1617 {
1618  if(level==0)return;
1619  DEBTRACE("ComposedNode::shutdown");
1620  list<Node *> nodes=edGetDirectDescendants();
1621  for(list<Node *>::iterator iter=nodes.begin();iter!=nodes.end();iter++)
1622  (*iter)->shutdown(level);
1623 }

References DEBTRACE, and edGetDirectDescendants().

Referenced by Handler(), and main().

◆ solveObviousOrDelegateCFLinks()

void ComposedNode::solveObviousOrDelegateCFLinks ( const std::list< OutPort * > &  starts,
InputPort end,
unsigned char &  alreadyFed,
bool  direction,
LinkInfo info 
) const
protected

Internal method during CF links. This methode is in charge to statuate on links consistency in the case that no control flow defined by user is set.

Definition at line 757 of file ComposedNode.cxx.

758 {
759  static const char what[]="ComposedNode::solveObviousOrDelegateCFLinks : Internal error occured - uncorrect hierarchy detected !";
760  if(starts.size()==1)
761  {
762  if(alreadyFed==FREE_ST)
763  {
764  if(!direction)
765  info.pushInfoLink(*(starts.begin()),end,I_BACK);
766  alreadyFed=FED_ST;
767  }
768  else if(alreadyFed==FED_ST)
769  info.pushInfoLink(*(starts.begin()),end,direction ? I_USELESS : I_BACK_USELESS);
770  else
771  info.pushErrLink(*(starts.begin()),end,E_COLLAPSE_DFDS);
772  }
773  else
774  {
775  Node *levelOfDecision=getLowestNodeDealingAll(starts);
776  if(levelOfDecision==this)
777  throw Exception(what);
778  if(dynamic_cast<ElementaryNode *>(levelOfDecision))
779  {
780  WarnReason reason;
781  if(alreadyFed==FREE_ST || alreadyFed==FED_ST)
782  {
783  if(alreadyFed==FREE_ST)
784  {
785  reason=direction ? W_COLLAPSE_EL : W_BACK_COLLAPSE_EL;
786  alreadyFed=FED_ST;
787  }
788  else
790  for(list< OutPort *>::const_iterator iter=starts.begin();iter!=starts.end();iter++)
791  info.pushWarnLink(*iter,end,reason);
792  }
793  }
794  else
795  ((ComposedNode *)levelOfDecision)->checkCFLinks(starts,end,alreadyFed,direction,info);
796  }
797 }
Node * getLowestNodeDealingAll(const std::list< OutPort * > &ports) const
@ W_COLLAPSE_EL_AND_USELESS
Definition: LinkInfo.hxx:59
@ W_BACK_COLLAPSE_EL_AND_USELESS
Definition: LinkInfo.hxx:63

References YACS::ENGINE::E_COLLAPSE_DFDS, FED_ST, FREE_ST, getLowestNodeDealingAll(), YACS::ENGINE::I_BACK, YACS::ENGINE::I_BACK_USELESS, YACS::ENGINE::I_USELESS, YACS::ENGINE::LinkInfo::pushErrLink(), YACS::ENGINE::LinkInfo::pushInfoLink(), YACS::ENGINE::LinkInfo::pushWarnLink(), YACS::ENGINE::W_BACK_COLLAPSE_EL, YACS::ENGINE::W_BACK_COLLAPSE_EL_AND_USELESS, YACS::ENGINE::W_COLLAPSE_EL, and YACS::ENGINE::W_COLLAPSE_EL_AND_USELESS.

Referenced by checkCFLinks(), YACS::ENGINE::DynParaLoop::checkCFLinks(), YACS::ENGINE::ForLoop::checkCFLinks(), YACS::ENGINE::Loop::checkCFLinks(), and YACS::ENGINE::OptimizerLoop::checkCFLinks().

◆ splitNamesBySep()

bool ComposedNode::splitNamesBySep ( const std::string &  globalName,
const char  separator[],
std::string &  firstPart,
std::string &  lastPart,
bool  priority 
)
staticprotected

Splits name globalName in 2 parts using separator.

Note
'priority' specifies if during search process of 'separator' the max part is for 'firstPart' (priority=true) or 'lastPart' (priority=false).
Exceptions
Exception: 'lastPart' or 'firstPart' is empty.
Returns
true if split process succeeds false otherwise (typically when character separator was not found).

Definition at line 561 of file ComposedNode.cxx.

563 {
564  const string delims(separator);
565  string portName, nodeName;
566  string::size_type idx;
567  if(priority)
568  idx = globalName.find_last_of(delims);
569  else
570  idx = globalName.find_first_of(delims);
571  if (idx == string::npos)
572  {
573  firstPart=globalName;
574  lastPart="";
575  return false;
576  }
577  firstPart = globalName.substr(0,idx);
578  lastPart = globalName.substr(idx+1);
579  if ((firstPart.empty()) || (lastPart.empty()))
580  {
581  string what("the name "); what+= globalName ; what+=" is not a valid port name";
582  throw Exception(what);
583  }
584  return true;
585 }

Referenced by getChildByName(), YACS::ENGINE::DynParaLoop::getDynInputPortByAbsName(), YACS::ENGINE::ForEachLoopGen::getDynOutPortByAbsName(), getInputDataStreamPort(), getInputPort(), getOutPort(), getOutputDataStreamPort(), and getOutputPort().

◆ typeName()

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

◆ updateStateFrom()

YACS::Event ComposedNode::updateStateFrom ( Node node,
YACS::Event  event,
const Executor execInst 
)
protected

Update node state on receiving event from a node.

Note
Runtime called method. Perform, the state updating, from the son node 'node' emitting the event 'event' (among Executor static const var). WARNING Precondition : this == node->_father
Returns
The event (among Executor static const var) destinated to this->_father node to perform eventually up level update.

Calls ComposedNode::updateStateOnStartEventFrom if event is YACS::START

Calls ComposedNode::updateStateOnFinishedEventFrom if event is YACS::FINISH

Called by ComposedNode::notifyFrom

Definition at line 1382 of file ComposedNode.cxx.

1386 {
1387  DEBTRACE("updateStateFrom: " << node->getName() << " " << event);
1388  try
1389  {
1390  switch(event)
1391  {
1392  case YACS::START:
1393  return updateStateOnStartEventFrom(node);
1394  break;
1395  case YACS::FINISH:
1396  return updateStateOnFinishedEventFrom(node);
1397  break;
1398  case YACS::ABORT:
1399  return updateStateOnFailedEventFrom(node,execInst);
1400  break;
1401  default:
1402  return YACS::NOEVENT;//TODO unexpected type of event
1403  break;
1404  }
1405  }
1406  catch(YACS::Exception& ex)
1407  {
1408  //unexpected exception: probably a bug in engine
1409  //try to keep a consistent global state
1410  DEBTRACE( "updateStateFrom: " << ex.what() );
1411  _errorDetails="Internal error: ";
1412  _errorDetails=_errorDetails + ex.what();
1414  exForwardFailed();
1415  return YACS::ABORT;
1416  }
1417  catch(...)
1418  {
1419  //unexpected exception: probably a bug in engine
1420  //try to keep a consistent global state
1422  exForwardFailed();
1423  return YACS::ABORT;
1424  }
1425 }
virtual YACS::Event updateStateOnFailedEventFrom(Node *node, const Executor *execInst)
Method used to notify the node that a child node has failed.
virtual YACS::Event updateStateOnFinishedEventFrom(Node *node)=0
virtual YACS::Event updateStateOnStartEventFrom(Node *node)
Method used to notify the node that a child node has started.
virtual void exForwardFailed()
Definition: Node.cxx:378
@ ABORT
Definition: define.hxx:60
@ START
Definition: define.hxx:58
@ FINISH
Definition: define.hxx:59

References YACS::ENGINE::Node::_errorDetails, YACS::ABORT, DEBTRACE, YACS::ERROR, testCppPluginInvokation::ex, YACS::ENGINE::Node::exForwardFailed(), YACS::FINISH, YACS::ENGINE::Node::getName(), YACS::NOEVENT, YACS::ENGINE::Node::setState(), YACS::START, updateStateOnFailedEventFrom(), updateStateOnFinishedEventFrom(), and updateStateOnStartEventFrom().

Referenced by notifyFrom().

◆ updateStateOnFailedEventFrom()

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

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

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

Definition at line 1441 of file ComposedNode.cxx.

1442 {
1444  return YACS::ABORT;
1445 }

References YACS::ABORT, YACS::FAILED, and YACS::ENGINE::Node::setState().

Referenced by updateStateFrom().

◆ updateStateOnFinishedEventFrom()

virtual YACS::Event YACS::ENGINE::ComposedNode::updateStateOnFinishedEventFrom ( Node node)
protectedpure virtual

◆ updateStateOnStartEventFrom()

YACS::Event ComposedNode::updateStateOnStartEventFrom ( Node node)
protectedvirtual

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

Update the ComposedNode state and return the ComposedNode change state

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

Definition at line 1434 of file ComposedNode.cxx.

1435 {
1437  return YACS::START;
1438 }

References YACS::ACTIVATED, YACS::ENGINE::Node::setState(), and YACS::START.

Referenced by updateStateFrom().

Friends And Related Function Documentation

◆ Bloc

friend class Bloc
friend

Definition at line 44 of file ComposedNode.hxx.

Referenced by YACS::ENGINE::Bloc::simpleClone().

◆ ElementaryNode

friend class ElementaryNode
friend

Definition at line 47 of file ComposedNode.hxx.

◆ Loop

friend class Loop
friend

Definition at line 45 of file ComposedNode.hxx.

◆ OutPort

friend class OutPort
friend

Definition at line 46 of file ComposedNode.hxx.

Member Data Documentation

◆ FED_DS_ST

const unsigned char YACS::ENGINE::ComposedNode::FED_DS_ST = 1
staticprotected

◆ FED_ST

◆ FREE_ST

◆ SEP_CHAR_BTW_LEVEL

const char ComposedNode::SEP_CHAR_BTW_LEVEL ="."
static

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