20 #ifndef __ELEMENTARYNODE_HXX__
21 #define __ELEMENTARYNODE_HXX__
40 class InputDataStreamPort;
41 class OutputDataStreamPort;
59 void performDuplicationOfPlacement(
const Node& other);
60 void performShallowDuplicationOfPlacement(
const Node& other);
64 void init(
bool start=
true);
65 bool isDeployable()
const;
70 void getReadyTasks(std::vector<Task *>& tasks);
71 void edRemovePort(
Port *port) ;
72 std::list<ElementaryNode *> getRecursiveConstituents()
const;
73 std::list<ProgressWeight> getProgressWeight()
const;
74 Node *getChildByName(
const std::string& name)
const ;
75 virtual void checkBasicConsistency()
const ;
77 int getNumberOfInputPorts()
const;
78 int getNumberOfOutputPorts()
const;
79 std::string getInPortName(
const InPort *)
const ;
80 std::string getOutPortName(
const OutPort *)
const ;
81 InputPort *getInputPort(
const std::string& name)
const ;
82 OutputPort *getOutputPort(
const std::string& name)
const ;
87 std::set<OutPort *> getAllOutPortsLeavingCurrentScope()
const;
88 std::set<InPort *> getAllInPortsComingFromOutsideOfCurrentScope()
const;
89 virtual std::vector< std::pair<OutPort *, InPort *> > getSetOfLinksLeavingCurrentScope()
const;
90 virtual std::vector< std::pair<InPort *, OutPort *> > getSetOfLinksComingInCurrentScope()
const;
95 virtual InputPort *createInputPort(
const std::string& inputPortName,
TypeCode* type);
96 virtual OutputPort *createOutputPort(
const std::string& outputPortName,
TypeCode* type);
99 virtual InputPort *edAddInputPort(
const std::string& inputPortName,
TypeCode* type) ;
100 virtual OutputPort *edAddOutputPort(
const std::string& outputPortName,
TypeCode* type) ;
103 virtual void edOrderInputPorts(
const std::list<InputPort*>& ports);
104 virtual void edOrderOutputPorts(
const std::list<OutputPort*>& ports);
106 virtual std::string
typeName() {
return "YACS__ENGINE__ElementaryNode";}
107 virtual void edUpdateState();
108 virtual void ensureLoading();
112 void setWeight(
double elementaryWeight);
123 virtual std::string getErrorDetails();
128 virtual void getCoupledTasks(std::set<Task*>& coupledSet);
129 virtual void getCoupledNodes(std::set<Task*>& coupledSet);
137 void initCommonPartWithoutStateManagement(
bool start);
139 virtual void createMultiDatastreamPorts();
141 void edDisconnectAllLinksWithMe();
142 bool areAllInputPortsValid()
const;
144 PORT *getPort(
const std::string& name,
const std::list<PORT *>& setOfPorts)
const ;
145 template<
class PORT,
class ENUMTYPE>
146 PORT *edAddPort(
const std::string& portName, std::list<PORT *>& setOfPorts, ENUMTYPE type) ;
147 template<
class PORT,
class ENUMTYPE>
148 bool edCheckAddPort(
const std::string& portName, std::list<PORT *>& setOfPorts, ENUMTYPE type) ;
150 static void edRemovePortTypedFromSet(PORT *port, std::list<PORT *>& setOfPorts) ;
152 static bool isPortNameAlreadyExist(
const std::string& portName,
const std::list<PORT *>& setOfPorts);
162 for(
typename std::list<PORT *>::const_iterator iter=setOfPorts.begin();iter!=setOfPorts.end();iter++)
164 if((*iter)->getName()==name)
167 std::string what=
"ElementaryNode::getPort : unexisting "; what+=PORT::NAME;
178 template<
class PORT,
class ENUMTYPE>
182 if(isPortNameAlreadyExist<PORT>(portName, setOfPorts))
184 std::string what=
"Port of type "; what+=PORT::NAME; what +=
" with name : "; what+=portName; what+=
" already exists";
187 PORT *ret=
new PORT(portName,
this,type);
188 setOfPorts.push_back(ret);
192 template<
class PORT,
class ENUMTYPE>
196 if(isPortNameAlreadyExist<PORT>(portName, setOfPorts))
198 std::string what=
"Port of type "; what+=PORT::NAME; what +=
" with name : "; what+=portName; what+=
" already exists";
211 if(!isPortNameAlreadyExist<PORT>(port->getName(), setOfPorts))
212 throw Exception(
"Port is not part of the list : unable to remove it");
213 typename std::list<PORT *>::iterator iter=std::find(setOfPorts.begin(),setOfPorts.end(),port);
214 if(iter!=setOfPorts.end())
216 (*iter)->edRemoveAllLinksLinkedWithMe();
217 setOfPorts.erase(iter);
228 for(
typename std::list<PORT *>::const_iterator iter=setOfPorts.begin();iter!=setOfPorts.end();iter++)
230 if((*iter)->getName()==portName)
#define YACSLIBENGINE_EXPORT
void addWeight(const ComplexWeight *other)
Base class for all component instances.
Base class for all composed nodes.
Base class for all calculation nodes.
ComplexWeight * getWeight()
static void edRemovePortTypedFromSet(PORT *port, std::list< PORT * > &setOfPorts)
std::list< OutputPort * > getSetOfOutputPort() const
std::list< InputPort * > _setOfInputPort
std::list< OutputDataStreamPort * > _setOfOutputDataStreamPort
bool _createDatastreamPorts
std::list< InputPort * > getLocalInputPorts() const
virtual void addDatastreamPortToInitMultiService(const std::string &port_name, int number)
std::list< InputDataStreamPort * > _setOfInputDataStreamPort
std::list< InputPort * > getSetOfInputPort() const
std::list< OutputPort * > _setOfOutputPort
int getMaxLevelOfParallelism() const
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort() const
PORT * getPort(const std::string &name, const std::list< PORT * > &setOfPorts) const
PORT * edAddPort(const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type)
virtual std::string typeName()
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort() const
static bool isPortNameAlreadyExist(const std::string &portName, const std::list< PORT * > &setOfPorts)
void partitionRegardingDPL(const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)
void getWeightRegardingDPL(ComplexWeight *weight)
virtual void initService()
virtual void disconnectService()
virtual void connectService()
bool edCheckAddPort(const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type)
std::list< OutputPort * > getLocalOutputPorts() const
Base class for all nodes.
static void checkValidityOfPortName(const std::string &name)
Base class for all ports.
Base class for all type objects.