The Gaudi Framework  v29r0 (ff2e7097)
PRGraphVisitors.h
Go to the documentation of this file.
1 #ifndef PRGRAPHVISITORS_H_
2 #define PRGRAPHVISITORS_H_
3 
4 #include "EventSlot.h"
5 #include "IGraphVisitor.h"
6 #include "PrecedenceRulesGraph.h"
7 
8 namespace concurrency
9 {
10 
12  {
13  public:
15  DataReadyPromoter( EventSlot& slot, const Cause& cause, bool ifTrace = false )
16  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
17 
20 
21  bool visitEnter( AlgorithmNode& ) const override;
22 
23  bool visit( AlgorithmNode& ) override;
24 
25  bool visitEnter( DataNode& ) const override;
26 
27  bool visit( DataNode& ) override;
28 
29  bool visitEnter( ConditionNode& ) const override;
30 
31  bool visit( ConditionNode& ) override;
32 
35  bool m_trace;
36  };
37 
39  {
40  public:
42  DecisionUpdater( EventSlot& slot, const Cause& cause, bool ifTrace = false )
43  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
44 
46 
47  bool visit( AlgorithmNode& ) override;
48 
51  bool m_trace;
52  };
53 
54  class Supervisor : public IGraphVisitor
55  {
56  public:
58  Supervisor( EventSlot& slot, const Cause& cause, bool ifTrace = false )
59  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
60 
63 
64  bool visitEnter( DecisionNode& ) const override;
65 
66  bool visit( DecisionNode& ) override;
67 
68  bool visitEnter( AlgorithmNode& ) const override;
69 
70  bool visit( AlgorithmNode& ) override;
71 
74  bool m_trace;
75  };
76 
78  {
79  public:
81 
82  bool visit( AlgorithmNode& ) override;
83  };
84 
86  {
87  public:
89 
90  bool visit( AlgorithmNode& ) override;
91  void reset() override { m_nodesSucceeded = 0; };
92 
93  void runThroughAdjacents( boost::graph_traits<precedence::PrecTrace>::vertex_descriptor, precedence::PrecTrace );
94 
95  int m_nodesSucceeded{0};
96  };
97 
99  {
100  public:
101  using IGraphVisitor::visit;
102 
103  bool visit( AlgorithmNode& ) override;
104  };
105 
107  {
108  public:
109  using IGraphVisitor::visit;
110 
111  bool visit( AlgorithmNode& ) override;
112  };
113 
115  {
116  public:
117  using IGraphVisitor::visit;
118 
119  bool visit( AlgorithmNode& ) override;
120 
121  void reset() override
122  {
123  m_currentDepth = 0;
124  m_maxKnownDepth = 0;
125  }
126 
129  void recursiveVisit( AlgorithmNode& );
130 
131  uint m_currentDepth{0};
132  uint m_maxKnownDepth{0};
133  };
134 
136  {
137  public:
139  RunSimulator( EventSlot& slot, const Cause& cause ) : m_slot( &slot ), m_cause( cause ){};
140 
141  using IGraphVisitor::visit;
143 
144  bool visitEnter( DecisionNode& ) const override;
145 
146  bool visit( DecisionNode& ) override;
147 
148  bool visitEnter( AlgorithmNode& ) const override;
149 
150  bool visit( AlgorithmNode& ) override;
151 
152  void reset() override { m_nodesSucceeded = 0; };
153 
154  EventSlot* m_slot;
156  int m_nodesSucceeded{0};
157  };
158 }
159 
160 #endif /* PRGRAPHVISITORS_H_ */
bool visit(AlgorithmNode &) override
virtual bool visit(DecisionNode &)
Definition: IGraphVisitor.h:18
bool visitEnter(AlgorithmNode &) const override
virtual bool visitEnter(DecisionNode &) const
Definition: IGraphVisitor.h:17
RunSimulator(EventSlot &slot, const Cause &cause)
Constructor.
DataReadyPromoter(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AlgoTraceProps > PrecTrace
Class representing the event slot.
Definition: EventSlot.h:11
DecisionUpdater(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Supervisor(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.