X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fengine%2FElementaryNode.cxx;h=d227016b9bfb3542e7209a44ed99752a91644b43;hb=c9208a8ef7f32a620d9650908588320ff159a167;hp=1aa6ae7fa6e70c5bf0e248aad686d6c52da0f4ab;hpb=c81be9b5e74b26e207bd6efd0ccf68418ac536a3;p=modules%2Fyacs.git diff --git a/src/engine/ElementaryNode.cxx b/src/engine/ElementaryNode.cxx index 1aa6ae7fa..d227016b9 100644 --- a/src/engine/ElementaryNode.cxx +++ b/src/engine/ElementaryNode.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2012 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 // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -47,11 +47,13 @@ using namespace std; 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; @@ -69,6 +71,10 @@ void ElementaryNode::performDuplicationOfPlacement(const Node& other) { } +void ElementaryNode::performShallowDuplicationOfPlacement(const Node& other) +{ +} + ElementaryNode::~ElementaryNode() { for(list::iterator iter1=_setOfInputPort.begin();iter1!=_setOfInputPort.end();iter1++) @@ -81,24 +87,25 @@ ElementaryNode::~ElementaryNode() delete *iter4; } -void ElementaryNode::init(bool start) +void ElementaryNode::initCommonPartWithoutStateManagement(bool start) { - DEBTRACE("ElementaryNode::init " << getName() << " " << start << " " << _state); - for(list::iterator iter=_setOfOutputPort.begin();iter!=_setOfOutputPort.end();iter++) (*iter)->exInit(); for(list::iterator iter2=_setOfInputPort.begin();iter2!=_setOfInputPort.end();iter2++) (*iter2)->exInit(start); _inGate.exReset(); +} + +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; + return ; } - if(start) //complete initialization - setState(YACS::READY); - else if(_state > YACS::LOADED)//partial initialization (inside a loop) - setState(YACS::TORECONNECT); + setState(YACS::READY); } bool ElementaryNode::isDeployable() const @@ -111,6 +118,11 @@ ComponentInstance *ElementaryNode::getComponent() return 0; } +const ComponentInstance *ElementaryNode::getComponent() const +{ + return 0; +} + Container *ElementaryNode::getContainer() { return 0; @@ -423,10 +435,10 @@ void ElementaryNode::getReadyTasks(std::vector& tasks) std::string input_port_name = (*iter1)->getName(); // Get Port Name in master node InputPort * master_port = getInputPort(input_port_name); - for (std::set::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)); } } @@ -538,6 +550,24 @@ list ElementaryNode::getRecursiveConstituents() const return ret; } +//! Get the progress weight for all elementary nodes +/*! + * Only elementary nodes have weight. At this stage weight is 0 or 1 (it can be modified later following + * the kind of father) + */ +list ElementaryNode::getProgressWeight() const +{ + list ret; + ProgressWeight myWeight; + myWeight.weightTotal=1; + if (getState() == YACS::DONE) + myWeight.weightDone=1; + else + myWeight.weightDone=0; + ret.push_back(myWeight); + return ret; +} + Node *ElementaryNode::getChildByName(const std::string& name) const throw(YACS::Exception) { string what("ElementaryNode does not agregate any nodes particullary node with name "); what+=name; @@ -864,3 +894,10 @@ void ElementaryNode::getCoupledNodes(std::set& coupledSet) } } +void ElementaryNode::setWeight(double elementaryWeight) +{ + if(elementaryWeight<=0.) + throw Exception("ElementaryNode::setWeight : invalid input value !"); + _weight.setElementaryWeight(elementaryWeight); +} +