20 #ifndef __ELEMENTARYNODE_HXX__
21 #define __ELEMENTARYNODE_HXX__
40 class InputDataStreamPort;
41 class OutputDataStreamPort;
58 void performDuplicationOfPlacement(
const Node& other);
59 void performShallowDuplicationOfPlacement(
const Node& other);
63 void init(
bool start=
true);
64 bool isDeployable()
const;
69 void getReadyTasks(std::vector<Task *>& tasks);
71 std::list<ElementaryNode *> getRecursiveConstituents()
const;
72 std::list<ProgressWeight> getProgressWeight()
const;
73 Node *getChildByName(
const std::string& name)
const throw(
Exception);
74 virtual void checkBasicConsistency()
const throw(
Exception);
76 int getNumberOfInputPorts() const;
77 int getNumberOfOutputPorts() const;
78 std::
string getInPortName(const
InPort *) const throw (Exception);
79 std::
string getOutPortName(const
OutPort *) const throw (Exception);
80 InputPort *getInputPort(const std::
string& name) const throw(Exception);
81 OutputPort *getOutputPort(const std::
string& name) const throw(Exception);
82 std::list<
InputPort *> getSetOfInputPort()
const {
return _setOfInputPort; }
86 std::set<OutPort *> getAllOutPortsLeavingCurrentScope()
const;
87 std::set<InPort *> getAllInPortsComingFromOutsideOfCurrentScope()
const;
88 virtual std::vector< std::pair<OutPort *, InPort *> > getSetOfLinksLeavingCurrentScope()
const;
89 virtual std::vector< std::pair<InPort *, OutPort *> > getSetOfLinksComingInCurrentScope()
const;
94 virtual InputPort *createInputPort(
const std::string& inputPortName,
TypeCode* type);
95 virtual OutputPort *createOutputPort(
const std::string& outputPortName,
TypeCode* type);
102 virtual void edOrderInputPorts(
const std::list<InputPort*>& ports);
103 virtual void edOrderOutputPorts(
const std::list<OutputPort*>& ports);
105 virtual std::string
typeName() {
return "YACS__ENGINE__ElementaryNode";}
106 virtual void edUpdateState();
107 virtual void ensureLoading();
118 virtual std::string getErrorDetails();
123 virtual void getCoupledTasks(std::set<Task*>& coupledSet);
124 virtual void getCoupledNodes(std::set<Task*>& coupledSet);
129 virtual void addDatastreamPortToInitMultiService(
const std::string & port_name,
132 void initCommonPartWithoutStateManagement(
bool start);
134 virtual void createMultiDatastreamPorts();
136 void edDisconnectAllLinksWithMe();
137 bool areAllInputPortsValid()
const;
139 PORT *getPort(
const std::string& name,
const std::list<PORT *>& setOfPorts)
const throw(
Exception);
140 template<
class PORT,
class ENUMTYPE>
141 PORT *edAddPort(
const std::string& portName, std::list<PORT *>& setOfPorts, ENUMTYPE type)
throw(
Exception);
142 template<
class PORT,
class ENUMTYPE>
143 bool edCheckAddPort(
const std::string& portName, std::list<PORT *>& setOfPorts, ENUMTYPE type)
throw(
Exception);
145 static void edRemovePortTypedFromSet(PORT *port, std::list<PORT *>& setOfPorts)
throw(
Exception);
147 static bool isPortNameAlreadyExist(
const std::string& portName,
const std::list<PORT *>& setOfPorts);
157 for(
typename std::list<PORT *>::const_iterator iter=setOfPorts.begin();iter!=setOfPorts.end();iter++)
159 if((*iter)->getName()==name)
162 std::string what=
"ElementaryNode::getPort : unexisting "; what+=PORT::NAME;
173 template<
class PORT,
class ENUMTYPE>
176 checkValidityOfPortName(portName);
177 if(isPortNameAlreadyExist<PORT>(portName, setOfPorts))
179 std::string what=
"Port of type "; what+=PORT::NAME; what +=
" with name : "; what+=portName; what+=
" already exists";
182 PORT *
ret=
new PORT(portName,
this,type);
183 setOfPorts.push_back(ret);
187 template<
class PORT,
class ENUMTYPE>
190 checkValidityOfPortName(portName);
191 if(isPortNameAlreadyExist<PORT>(portName, setOfPorts))
193 std::string what=
"Port of type "; what+=PORT::NAME; what +=
" with name : "; what+=portName; what+=
" already exists";
206 if(!isPortNameAlreadyExist<PORT>(port->getName(), setOfPorts))
207 throw Exception(
"Port is not part of the list : unable to remove it");
208 typename std::list<PORT *>::iterator iter=std::find(setOfPorts.begin(),setOfPorts.end(),port);
209 if(iter!=setOfPorts.end())
211 (*iter)->edRemoveAllLinksLinkedWithMe();
212 setOfPorts.erase(iter);
223 for(
typename std::list<PORT *>::const_iterator iter=setOfPorts.begin();iter!=setOfPorts.end();iter++)
225 if((*iter)->getName()==portName)