69 Node::Node(
const std::string& name):_name(name),_inGate(this),_outGate(this),_father(0),_state(
YACS::
READY),
70 _implementation(
Runtime::RUNTIME_ENGINE_INTERACTION_IMPL_NAME),_modified(1)
82 _state(
YACS::
READY),_implementation(other._implementation),
83 _propertyMap(other._propertyMap),_modified(1)
171 std::string what(
"Name ");
173 what+=
" already exists in the scope of "; what+=
_father->
getName();
189 for(list<InGate *>::iterator iter=inGates.begin();iter!=inGates.end();iter++)
190 ret.push_back((*iter)->getNode());
262 if (name ==
"__InPropertyPort__Node__YACS_")
266 std::string what(
"Node::getInputPort : the port with name "); what+=name; what+=
" does not exist on the current level";
293 ret.insert(ret.end(),data.begin(),data.end());
295 ret.insert(ret.end(),ds.begin(),ds.end());
303 ret.insert(ret.end(),data.begin(),data.end());
305 ret.insert(ret.end(),ds.begin(),ds.end());
319 list<ComposedNode *> ret;
320 if(
this==levelToStop)
330 while(iter!=0 && iter!=
this)
338 while(iter!=0 && iter!=(&other))
340 return iter==(&other);
358 set<InputPort *> setOfUnitializedInputPort;
360 for(list<InputPort *>::const_iterator iter=allOfInputPorts.begin();iter!=allOfInputPorts.end();iter++)
362 if ( ! (*iter)->edIsInitialized() )
363 setOfUnitializedInputPort.insert(*iter);
365 return setOfUnitializedInputPort;
372 return ( setOfUnitializedInputPort.size() == 0);
388 DEBTRACE(
"Node::exForwardFinished");
450 string what(
"Port name "); what+=name; what+=
"not valid because it contains character "; what+=
SEP_CHAR_IN_PORT;
473 return node1->_father;
475 throw Exception(
"check failed : nodes have not the same father");
483 string::size_type debut =
id.find_first_of(
'.');
484 while(debut != std::string::npos){
486 debut=
id.find_first_of(
'.',debut);
493 DEBTRACE(
"Node::setProperty " << name <<
" " << value);
499 std::map<std::string,std::string>::iterator it=
_propertyMap.find(name);
515 amap.insert(fatherMap.begin(),fatherMap.end());
558 switch(effectiveState)
613 os <<
getId() <<
"[fillcolor=\"" ;
622 std::ofstream
f(fileName);
662 std::vector< std::pair<std::string,int> > ret;
665 while(work!=gfn && work!=0)
693 DEBTRACE(
"Node::sendEvent " << event);
758 return "<error node= "+
getName()+
"state= DISABLED/>\n";
767 std::string report=
"<error node= " ;
769 switch(effectiveState)
772 report=report+
" state= INVALID";
775 report=report+
" state= ERROR";
778 report=report+
" state= FAILED";
781 report=report+
" state= INTERNALERR";
786 report=report +
">\n" ;
788 report=report+
"\n</error>";
830 return nodeStateNameMap[
state];
859 for (std::list<OutGate*>::iterator io = backlinks.begin(); io != backlinks.end(); io++)
861 Node* fromNode = (*io)->getNode();
Base class for all composed nodes.
std::string getChildName(const Node *node) const
Node * getChildByName(const std::string &name) const
virtual bool isNameAlreadyUsed(const std::string &name) const
std::string getName() const
static const char SEP_CHAR_BTW_LEVEL[]
std::string getProperty(const std::string &name) override
virtual std::string getMyQualifiedName(const Node *directSon) const
Base class for dispatcher in observer pattern.
virtual void dispatchFromClone(Node *originalInstance, const std::string &event, Node *clonedInstanceGeneratingEvent)
virtual void dispatch(Node *object, const std::string &event)
static Dispatcher * getDispatcher()
virtual void dispatch2(Node *object, const std::string &event, void *something)
Base class for dynamically (fully or semifully) built graphs.
int getBranchIDOfNode(Node *node) const
void setPrecursorDone(OutGate *fromgate)
void edDisconnectAllLinksToMe()
std::list< OutGate * > getBackLinks()
class for Input Property Ports
Base class for all nodes.
virtual void edUpdateState()
update the status of the node
static std::map< int, Node * > idMap
static void checkValidityOfPortName(const std::string &name)
virtual void sendEvent2(const std::string &event, void *something)
emit notification to all observers registered with the dispatcher
virtual std::list< OutputPort * > getSetOfOutputPort() const =0
virtual void exForwardFinished()
virtual Node * simpleClone(ComposedNode *father, bool editionOnly=true) const =0
InPropertyPort * getInPropertyPort() const
virtual ComposedNode * getRootNode() const
void writeDotInFile(const std::string &fileName) const
static std::string getStateName(YACS::StatesForNode state)
Return the name of a state.
virtual void shutdown(int level)
Stop all pending activities of the node.
std::string getImplementation() const
virtual void setProperty(const std::string &name, const std::string &value)
std::string getColorState(YACS::StatesForNode state) const
Return the color associated to a state.
std::vector< std::pair< std::string, int > > getDPLScopeInfo(ComposedNode *gfn)
virtual InputDataStreamPort * getInputDataStreamPort(const std::string &name) const =0
virtual std::list< InputDataStreamPort * > getSetOfInputDataStreamPort() const =0
Node(const std::string &name)
virtual void modified()
Sets Node in modified state and its father if it exists.
std::string getQualifiedName() const
same as Node::getName() in most cases, but differs for children of switch
void setName(const std::string &name)
Change the name of the node.
virtual std::set< InputPort * > edGetSetOfUnitializedInputPort() const
Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency.
InPropertyPort * _inPropertyPort
std::list< Node * > getOutNodes() const
virtual void exUpdateState()
Update the node state.
virtual void applyDPLScope(ComposedNode *gfn)
Node * clone(ComposedNode *father, bool editionOnly=true) const
This method MUST NEVER BE VIRTUAL
const std::string getId() const
std::map< std::string, std::string > _propertyMap
static ComposedNode * checkHavingCommonFather(Node *node1, Node *node2)
virtual void performDuplicationOfPlacement(const Node &other)=0
performs a duplication of placement using clone method of containers and components....
virtual std::string getContainerLog()
returns a string that contains the name of the container log file if it exists
virtual void init(bool start=true)
friend class InPropertyPort
virtual void cleanNodes()
Clean the node in case of not clean exit.
virtual OutPort * getOutPort(const std::string &name) const
ComposedNode * getFather() const
virtual void writeDot(std::ostream &os) const
Dump to the input stream a dot representation of the node.
static void checkValidityOfNodeName(const std::string &name)
std::list< OutPort * > getSetOfOutPort() const
std::list< ComposedNode * > getAllAscendanceOf(ComposedNode *levelToStop=0) const
std::map< std::string, std::string > getProperties()
virtual void resetState(int level)
Reset the node state depending on the parameter level.
std::list< InPort * > getSetOfInPort() const
void setState(YACS::StatesForNode theState)
Sets the given state for node.
DynParaLoop * getClosestDPLAmongAncestors() const
std::string _implementation
virtual void exDisabledState()
Notify this node that it has been disabled.
virtual std::string getErrorReport()
returns a string that contains an error report if the node is in error
bool operator<(const Node &other) const
virtual YACS::StatesForNode getState() const
virtual void sendEvent(const std::string &event)
emit notification to all observers registered with the dispatcher
virtual void setProperties(std::map< std::string, std::string > properties)
virtual void performShallowDuplicationOfPlacement(const Node &other)=0
performs a also duplication of placement but here containers and components are not copied at all wha...
bool operator>(const Node &other) const
virtual std::list< InputPort * > getSetOfInputPort() const =0
Node * cloneWithoutCompAndContDeepCpy(ComposedNode *father, bool editionOnly=true) const
This method MUST NEVER BE VIRTUAL
virtual int isValid()
indicates if the node is valid (returns 1) or not (returns 0)
static const char SEP_CHAR_IN_PORT[]
InPort * getInPort(const std::string &name) const
const std::string & getName() const
virtual InputPort * getInputPort(const std::string &name) const
virtual void exForwardFailed()
virtual OutputPort * getOutputPort(const std::string &name) const =0
virtual void ensureLoading()
Put this node into TOLOAD state when possible.
std::string _errorDetails
virtual YACS::StatesForNode getEffectiveState() const
Return the node state in the context of its father.
YACS::StatesForNode _state
virtual bool edAreAllInputPortInitialized() const
Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency.
int getNumId()
return node instance identifiant, unique for each node instance
bool exIsControlReady() const
virtual std::string getProperty(const std::string &name)
virtual void exFailedState()
Notify this node that its execution has failed.
virtual OutputDataStreamPort * getOutputDataStreamPort(const std::string &name) const =0
virtual std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort() const =0
virtual void edDisconnectAllLinksWithMe()
void edDisconnectAllLinksFromMe()
std::list< InGate * > edSetInGate() const
void exNotifyDone()
Notify this port that its node is finished.
void exNotifyFailed()
Notify this port that its node has failed.
void exNotifyDisabled()
Notify this port that its node has been disabled.
Base class for all schema objects.
static YACS::ENGINE::TypeCode * _tc_propvec
void YACSLIBENGINE_EXPORT StateLoader(Node *node, YACS::StatesForNode state)