Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
11  public:
13  DataReadyPromoter( EventSlot& slot, const Cause& cause, bool ifTrace = false )
14  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
15 
18 
19  bool visitEnter( AlgorithmNode& ) const override;
20 
21  bool visit( AlgorithmNode& ) override;
22 
23  bool visitEnter( DataNode& ) const override;
24 
25  bool visit( DataNode& ) override;
26 
27  bool visitEnter( ConditionNode& ) const override;
28 
29  bool visit( ConditionNode& ) override;
30 
33  bool m_trace;
34  };
35 
36  class DecisionUpdater : public IGraphVisitor {
37  public:
39  DecisionUpdater( EventSlot& slot, const Cause& cause, bool ifTrace = false )
40  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
41 
43 
44  bool visit( AlgorithmNode& ) override;
45 
48  bool m_trace;
49  };
50 
51  class Supervisor : public IGraphVisitor {
52  public:
54  Supervisor( EventSlot& slot, const Cause& cause, bool ifTrace = false )
55  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
56 
59 
60  bool visitEnter( DecisionNode& ) const override;
61 
62  bool visit( DecisionNode& ) override;
63 
64  bool visitEnter( AlgorithmNode& ) const override;
65 
66  bool visit( AlgorithmNode& ) override;
67 
70  bool m_trace;
71  };
72 
74  public:
76 
77  bool visit( AlgorithmNode& ) override;
78  };
79 
81  public:
83 
84  bool visit( AlgorithmNode& ) override;
85  void reset() override { m_nodesSucceeded = 0; };
86 
87  void runThroughAdjacents( boost::graph_traits<precedence::PrecTrace>::vertex_descriptor, precedence::PrecTrace );
88 
89  int m_nodesSucceeded{0};
90  };
91 
92  class RankerByTiming : public IGraphVisitor {
93  public:
95 
96  bool visit( AlgorithmNode& ) override;
97  };
98 
100  public:
101  using IGraphVisitor::visit;
102 
103  bool visit( AlgorithmNode& ) override;
104  };
105 
107  public:
108  using IGraphVisitor::visit;
109 
110  bool visit( AlgorithmNode& ) override;
111 
112  void reset() override {
113  m_currentDepth = 0;
114  m_maxKnownDepth = 0;
115  }
116 
119  void recursiveVisit( AlgorithmNode& );
120 
121  uint m_currentDepth{0};
122  uint m_maxKnownDepth{0};
123  };
124 
125  class RunSimulator : public IGraphVisitor {
126  public:
128  RunSimulator( EventSlot& slot, const Cause& cause ) : m_slot( &slot ), m_cause( cause ){};
129 
130  using IGraphVisitor::visit;
132 
133  bool visitEnter( DecisionNode& ) const override;
134 
135  bool visit( DecisionNode& ) override;
136 
137  bool visitEnter( AlgorithmNode& ) const override;
138 
139  bool visit( AlgorithmNode& ) override;
140 
141  void reset() override { m_nodesSucceeded = 0; };
142 
143  EventSlot* m_slot;
145  int m_nodesSucceeded{0};
146  };
147 } // namespace concurrency
148 
149 #endif /* PRGRAPHVISITORS_H_ */
Class representing an event slot.
Definition: EventSlot.h:14
bool visit(AlgorithmNode &) override
virtual bool visit(DecisionNode &)
Definition: IGraphVisitor.h:16
bool visitEnter(AlgorithmNode &) const override
virtual bool visitEnter(DecisionNode &) const
Definition: IGraphVisitor.h:15
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
DecisionUpdater(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Supervisor(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.