| The Gaudi Framework v32r1 (f65d50dc)

Promoters.h
Go to the documentation of this file.
1 #ifndef PROMOTERS_H_
2 #define PROMOTERS_H_
3
4 #include "../../EventSlot.h"
5 #include "../PrecedenceRulesGraph.h"
6 #include "IGraphVisitor.h"
7
8 namespace concurrency {
9
10 //--------------------------------------------------------------------------
11 class DataReadyPromoter : public IGraphVisitor {
12 public:
14 DataReadyPromoter( EventSlot& slot, const Cause& cause, bool ifTrace = false )
15 : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
16
17 using IGraphVisitor::visit;
18 using IGraphVisitor::visitEnter;
19
20 bool visitEnter( AlgorithmNode& ) const override;
21
22 bool visit( AlgorithmNode& ) override;
23
24 bool visitEnter( DataNode& ) const override;
25
26 bool visit( DataNode& ) override;
27
28 bool visitEnter( ConditionNode& ) const override;
29
30 bool visit( ConditionNode& ) override;
31
32 EventSlot* m_slot;
33 Cause m_cause;
34 bool m_trace;
35 };
36
37 //--------------------------------------------------------------------------
38 class DecisionUpdater : public IGraphVisitor {
39 public:
41 DecisionUpdater( EventSlot& slot, const Cause& cause, bool ifTrace = false )
42 : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
43
44 using IGraphVisitor::visit;
45
46 bool visit( AlgorithmNode& ) override;
47
48 EventSlot* m_slot;
49 Cause m_cause;
50 bool m_trace;
51 };
52
53 //--------------------------------------------------------------------------
54 class Supervisor : public IGraphVisitor {
55 public:
57 Supervisor( EventSlot& slot, const Cause& cause, bool ifTrace = false )
58 : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
59
60 using IGraphVisitor::visit;
61 using IGraphVisitor::visitEnter;
62
63 bool visitEnter( DecisionNode& ) const override;
64
65 bool visit( DecisionNode& ) override;
66
67 bool visitEnter( AlgorithmNode& ) const override;
68
69 bool visit( AlgorithmNode& ) override;
70
71 EventSlot* m_slot;
72 Cause m_cause;
73 bool m_trace;
74 };
75
76 //--------------------------------------------------------------------------
77 class RunSimulator : public IGraphVisitor {
78 public:
80 RunSimulator( EventSlot& slot, const Cause& cause ) : m_slot( &slot ), m_cause( cause ){};
81
82 using IGraphVisitor::visit;
83 using IGraphVisitor::visitEnter;
84
85 bool visitEnter( DecisionNode& ) const override;
86
87 bool visit( DecisionNode& ) override;
88
89 bool visitEnter( AlgorithmNode& ) const override;
90
91 bool visit( AlgorithmNode& ) override;
92
93 void reset() override { m_nodesSucceeded = 0; };
94
95 EventSlot* m_slot;
96 Cause m_cause;
97 int m_nodesSucceeded{0};
98 };
99 } // namespace concurrency
100
101 #endif /* PROMOTERS_H_ */
concurrency::Supervisor::m_slot
EventSlot * m_slot
Definition: Promoters.h:71
EventSlot
Class representing an event slot.
Definition: EventSlot.h:14
concurrency::DecisionNode
Definition: PrecedenceRulesGraph.h:430
concurrency::RunSimulator::m_nodesSucceeded
int m_nodesSucceeded
Definition: Promoters.h:97
concurrency::DataReadyPromoter::visit
bool visit(AlgorithmNode &) override
Definition: Promoters.cpp:22
concurrency::RunSimulator::reset
void reset() override
Definition: Promoters.h:93
concurrency::DataNode
Definition: PrecedenceRulesGraph.h:555
concurrency::RunSimulator
Definition: Promoters.h:77
concurrency
Definition: PrecedenceRulesGraph.cpp:27
concurrency::Supervisor::m_trace
bool m_trace
Definition: Promoters.h:73
concurrency::IGraphVisitor::visit
virtual bool visit(DecisionNode &)
Definition: IGraphVisitor.h:16
concurrency::IGraphVisitor::visitEnter
virtual bool visitEnter(DecisionNode &) const
Definition: IGraphVisitor.h:15
concurrency::DataReadyPromoter::m_slot
EventSlot * m_slot
Definition: Promoters.h:32
concurrency::DecisionUpdater::m_slot
EventSlot * m_slot
Definition: Promoters.h:48
concurrency::RunSimulator::visit
bool visit(DecisionNode &) override
Definition: Promoters.cpp:356
concurrency::DataReadyPromoter::visitEnter
bool visitEnter(AlgorithmNode &) const override
Definition: Promoters.cpp:14
concurrency::DecisionUpdater::visit
bool visit(AlgorithmNode &) override
Definition: Promoters.cpp:104
concurrency::RunSimulator::RunSimulator
RunSimulator(EventSlot &slot, const Cause &cause)
Constructor.
Definition: Promoters.h:80
concurrency::RunSimulator::m_cause
Cause m_cause
Definition: Promoters.h:96
Cause
Definition: PrecedenceRulesGraph.h:387
concurrency::DataReadyPromoter::DataReadyPromoter
DataReadyPromoter(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Definition: Promoters.h:14
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: Promoters.h:93
concurrency::DecisionUpdater
Definition: Promoters.h:38
concurrency::DecisionUpdater::m_trace
bool m_trace
Definition: Promoters.h:50
concurrency::IGraphVisitor
Definition: IGraphVisitor.h:11
concurrency::DataReadyPromoter::m_trace
bool m_trace
Definition: Promoters.h:34
concurrency::DataReadyPromoter::m_cause
Cause m_cause
Definition: Promoters.h:33
concurrency::Supervisor::visitEnter
bool visitEnter(DecisionNode &) const override
Definition: Promoters.cpp:153
concurrency::Supervisor::visit
bool visit(DecisionNode &) override
Definition: Promoters.cpp:160
concurrency::DecisionUpdater::m_cause
Cause m_cause
Definition: Promoters.h:49
concurrency::RunSimulator::visitEnter
bool visitEnter(DecisionNode &) const override
Definition: Promoters.cpp:349
concurrency::ConditionNode
Definition: PrecedenceRulesGraph.h:593
concurrency::AlgorithmNode
Definition: PrecedenceRulesGraph.h:475
IGraphVisitor.h
concurrency::DataReadyPromoter
Definition: Promoters.h:11
concurrency::Supervisor
Definition: Promoters.h:54
concurrency::Supervisor::m_cause
Cause m_cause
Definition: Promoters.h:72
concurrency::DecisionUpdater::DecisionUpdater
DecisionUpdater(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Definition: Promoters.h:41
concurrency::Supervisor::Supervisor
Supervisor(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Definition: Promoters.h:57