1 // Copyright (C) 2006-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include "YacsTrace.hxx"
26 using namespace YACS::ENGINE;
29 const char InGate::NAME[]="InGate";
31 InGate::InGate(Node *node):Port(node)
39 string InGate::getNameOfTypeOfCurrentInstance() const
44 void InGate::edDisconnectAllLinksToMe()
46 for(map<OutGate *, bool >::iterator iter=_backLinks.begin();iter!=_backLinks.end();iter++)
47 ((*iter).first)->edRemoveInGate(this,false);
51 //! Notify this port that an upstream node connected by a control flow link is finished
53 * Calls the node's gate method : Node::exUpdateState
55 * Called by OutGate::exNotifyDone
57 void InGate::exNotifyFromPrecursor(OutGate *from)
59 DEBTRACE("InGate::exNotifyFromPrecursor");
60 map< OutGate *, bool >::iterator iter=_backLinks.find(from);
63 _node->exUpdateState();
66 //! Notify this port that an upstream node connected by a control flow link has failed
70 void InGate::exNotifyFailed()
72 if(_node) _node->exFailedState();
75 //! Notify this port that an upstream node connected by a control flow link has been disabled
79 void InGate::exNotifyDisabled()
82 _node->exDisabledState();
85 void InGate::edAppendPrecursor(OutGate *from)
87 _backLinks[from]=false;
90 void InGate::edRemovePrecursor(OutGate *from)
92 _backLinks.erase(from);
95 int InGate::getNumberOfBackLinks() const
97 return _backLinks.size();
100 void InGate::exReset()
102 for(map<OutGate *, bool >::iterator iter=_backLinks.begin();iter!=_backLinks.end();iter++)
103 (*iter).second=false;
106 bool InGate::exIsReady() const
109 for(map<OutGate *, bool >::const_iterator iter=_backLinks.begin();iter!=_backLinks.end() && isReady;iter++)
110 isReady=(*iter).second;
114 std::list<OutGate *> InGate::getBackLinks()
116 list<OutGate *> listo;
117 for(map<OutGate *, bool >::iterator iter=_backLinks.begin();iter!=_backLinks.end();iter++)
118 listo.push_back(iter->first);
122 void InGate::setPrecursorDone(OutGate *from)
124 map< OutGate *, bool >::iterator iter=_backLinks.find(from);