-// Copyright (C) 2006-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
ElementaryNode::ElementaryNode(const std::string& name):
Node(name),
_createDatastreamPorts(false),
- _multi_port_node(false)
+ _multi_port_node(false),
+ _weight()
{
+ _weight.setDefaultElementary();
}
-ElementaryNode::ElementaryNode(const ElementaryNode& other, ComposedNode *father):Node(other,father)
+ElementaryNode::ElementaryNode(const ElementaryNode& other, ComposedNode *father):Node(other,father), _weight(other._weight)
{
_createDatastreamPorts = other._createDatastreamPorts;
_multi_port_node = other._multi_port_node;
for(list<InputPort *>::iterator iter2=_setOfInputPort.begin();iter2!=_setOfInputPort.end();iter2++)
(*iter2)->exInit(start);
_inGate.exReset();
- if(_state == YACS::DISABLED)
- {
- exDisabledState(); // to refresh propagation of DISABLED state
- return;
- }
}
void ElementaryNode::init(bool start)
{
DEBTRACE("ElementaryNode::init " << getName() << " " << start << " " << _state);
initCommonPartWithoutStateManagement(start);
+ if(_state == YACS::DISABLED)
+ {
+ exDisabledState(); // to refresh propagation of DISABLED state
+ return ;
+ }
setState(YACS::READY);
}
std::string input_port_name = (*iter1)->getName();
// Get Port Name in master node
InputPort * master_port = getInputPort(input_port_name);
- for (std::set<OutPort *>::const_iterator itt=master_port->_backLinks.begin(); itt!=master_port->_backLinks.end();itt++)
+ for (auto itt : master_port->_backLinks)
{
// Connect dataflow
- getProc()->edAddDFLink((*itt),(*iter1));
+ getProc()->edAddDFLink(itt.first,(*iter1));
}
}
}
}
+void ElementaryNode::setWeight(double elementaryWeight)
+{
+ if(elementaryWeight<=0.)
+ throw Exception("ElementaryNode::setWeight : invalid input value !");
+ _weight.setElementaryWeight(elementaryWeight);
+}
+