Salome HOME
PR: merge from BR_DATACONV_PR tag "mergeto_trunk_25oct06"
[modules/yacs.git] / src / engine / InGate.cxx
1 #include "InGate.hxx"
2 #include "Node.hxx"
3
4 using namespace YACS::ENGINE;
5 using namespace std;
6
7 const char InGate::NAME[]="InGate";
8
9 InGate::InGate(Node *node):Port(node),_nbPrecursor(0),_nbPrecursorDone(0),_colour(YACS::White)
10 {
11 }
12
13 string InGate::getNameOfTypeOfCurrentInstance() const
14 {
15   return NAME;
16 }
17
18 void InGate::exNotifyFromPrecursor()
19 {
20   _nbPrecursorDone++;
21   if(exIsReady() && _node)
22     _node->exUpdateState();
23 }
24
25 void InGate::edAppendPrecursor()
26 {
27   _nbPrecursor++;
28 }
29
30 void InGate::edRemovePrecursor()
31 {
32   _nbPrecursor--;
33 }
34
35 void InGate::edSet(int nbOfPrecursors)
36 {
37   _nbPrecursor=nbOfPrecursors;
38 }
39
40 void InGate::exReset()
41 {
42   _nbPrecursorDone=0;
43 }
44
45 bool InGate::exIsReady() const
46 {
47   return _nbPrecursor==_nbPrecursorDone;
48 }