1 // Copyright (C) 2006-2008 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
23 #include "YacsTrace.hxx"
25 using namespace YACS::ENGINE;
28 const char InGate::NAME[]="InGate";
30 InGate::InGate(Node *node):Port(node)
38 string InGate::getNameOfTypeOfCurrentInstance() const
43 void InGate::edDisconnectAllLinksToMe()
45 for(map<OutGate *, bool >::iterator iter=_backLinks.begin();iter!=_backLinks.end();iter++)
46 ((*iter).first)->edRemoveInGate(this,false);
50 //! Notify this port that an upstream node connected by a control flow link is finished
52 * Calls the node's gate method : Node::exUpdateState
54 * Called by OutGate::exNotifyDone
56 void InGate::exNotifyFromPrecursor(OutGate *from)
58 DEBTRACE("InGate::exNotifyFromPrecursor");
59 map< OutGate *, bool >::iterator iter=_backLinks.find(from);
62 _node->exUpdateState();
65 //! Notify this port that an upstream node connected by a control flow link has failed
69 void InGate::exNotifyFailed()
71 if(_node) _node->exFailedState();
74 //! Notify this port that an upstream node connected by a control flow link has been disabled
78 void InGate::exNotifyDisabled()
81 _node->exDisabledState();
84 void InGate::edAppendPrecursor(OutGate *from)
86 _backLinks[from]=false;
89 void InGate::edRemovePrecursor(OutGate *from)
91 _backLinks.erase(from);
94 int InGate::getNumberOfBackLinks() const
96 return _backLinks.size();
99 void InGate::exReset()
101 for(map<OutGate *, bool >::iterator iter=_backLinks.begin();iter!=_backLinks.end();iter++)
102 (*iter).second=false;
105 bool InGate::exIsReady() const
108 for(map<OutGate *, bool >::const_iterator iter=_backLinks.begin();iter!=_backLinks.end() && isReady;iter++)
109 isReady=(*iter).second;
113 std::list<OutGate *> InGate::getBackLinks()
115 list<OutGate *> listo;
116 for(map<OutGate *, bool >::iterator iter=_backLinks.begin();iter!=_backLinks.end();iter++)
117 listo.push_back(iter->first);
121 void InGate::setPrecursorDone(OutGate *from)
123 map< OutGate *, bool >::iterator iter=_backLinks.find(from);