The Gaudi Framework  master (37c0b60a)
Promoters.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef PROMOTERS_H_
12 #define PROMOTERS_H_
13 
14 #include "../../EventSlot.h"
15 #include "../PrecedenceRulesGraph.h"
16 #include "IGraphVisitor.h"
17 
18 namespace concurrency {
19 
20  //--------------------------------------------------------------------------
22  public:
24  DataReadyPromoter( EventSlot& slot, const Cause& cause, bool ifTrace = false )
25  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ) {}
26 
29 
30  bool visitEnter( AlgorithmNode& ) const override;
31 
32  bool visit( AlgorithmNode& ) override;
33 
34  bool visitEnter( DataNode& ) const override;
35 
36  bool visit( DataNode& ) override;
37 
38  bool visitEnter( ConditionNode& ) const override;
39 
40  bool visit( ConditionNode& ) override;
41 
44  bool m_trace;
45  };
46 
47  //--------------------------------------------------------------------------
48  class DecisionUpdater : public IGraphVisitor {
49  public:
51  DecisionUpdater( EventSlot& slot, const Cause& cause, bool ifTrace = false )
52  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ) {}
53 
55 
56  bool visit( AlgorithmNode& ) override;
57 
60  bool m_trace;
61  };
62 
63  //--------------------------------------------------------------------------
64  class Supervisor : public IGraphVisitor {
65  public:
67  Supervisor( EventSlot& slot, const Cause& cause, bool ifTrace = false )
68  : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ) {}
69 
72 
73  bool visitEnter( DecisionNode& ) const override;
74 
75  bool visit( DecisionNode& ) override;
76 
77  bool visitEnter( AlgorithmNode& ) const override;
78 
79  bool visit( AlgorithmNode& ) override;
80 
83  bool m_trace;
84  };
85 
86  //--------------------------------------------------------------------------
87  class RunSimulator : public IGraphVisitor {
88  public:
90  RunSimulator( EventSlot& slot, const Cause& cause ) : m_slot( &slot ), m_cause( cause ) {}
91 
94 
95  bool visitEnter( DecisionNode& ) const override;
96 
97  bool visit( DecisionNode& ) override;
98 
99  bool visitEnter( AlgorithmNode& ) const override;
100 
101  bool visit( AlgorithmNode& ) override;
102 
103  void reset() override { m_nodesSucceeded = 0; }
104 
108  };
109 } // namespace concurrency
110 
111 #endif /* PROMOTERS_H_ */
concurrency::RunSimulator::m_nodesSucceeded
int m_nodesSucceeded
Definition: Promoters.h:107
concurrency::Supervisor
Definition: Promoters.h:64
concurrency::DecisionUpdater::m_slot
EventSlot * m_slot
Definition: Promoters.h:58
concurrency::DataReadyPromoter::m_slot
EventSlot * m_slot
Definition: Promoters.h:42
concurrency::Supervisor::Supervisor
Supervisor(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Definition: Promoters.h:67
EventSlot
Class representing an event slot.
Definition: EventSlot.h:24
concurrency::DataReadyPromoter
Definition: Promoters.h:21
concurrency::DataReadyPromoter::m_trace
bool m_trace
Definition: Promoters.h:44
concurrency::RunSimulator::visit
bool visit(DecisionNode &) override
Definition: Promoters.cpp:361
concurrency::DecisionUpdater::visit
bool visit(AlgorithmNode &) override
Definition: Promoters.cpp:104
concurrency::Supervisor::visitEnter
bool visitEnter(DecisionNode &) const override
Definition: Promoters.cpp:152
concurrency::IGraphVisitor
Definition: IGraphVisitor.h:21
concurrency::DecisionUpdater::m_cause
Cause m_cause
Definition: Promoters.h:59
concurrency::RunSimulator::visitEnter
bool visitEnter(DecisionNode &) const override
Definition: Promoters.cpp:354
concurrency::AlgorithmNode
Definition: PrecedenceRulesGraph.h:484
concurrency::Supervisor::visit
bool visit(DecisionNode &) override
Definition: Promoters.cpp:159
concurrency::ConditionNode
Definition: PrecedenceRulesGraph.h:591
IGraphVisitor.h
concurrency::Supervisor::m_slot
EventSlot * m_slot
Definition: Promoters.h:81
concurrency::Supervisor::m_cause
Cause m_cause
Definition: Promoters.h:82
concurrency::IGraphVisitor::visit
virtual bool visit(DecisionNode &)
Definition: IGraphVisitor.h:26
concurrency
Definition: PrecedenceRulesGraph.cpp:38
concurrency::IGraphVisitor::visitEnter
virtual bool visitEnter(DecisionNode &) const
Definition: IGraphVisitor.h:25
concurrency::DecisionNode
Definition: PrecedenceRulesGraph.h:439
concurrency::DecisionUpdater
Definition: Promoters.h:48
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: Promoters.h:105
concurrency::DataReadyPromoter::visit
bool visit(AlgorithmNode &) override
Definition: Promoters.cpp:32
concurrency::DataReadyPromoter::m_cause
Cause m_cause
Definition: Promoters.h:43
concurrency::DecisionUpdater::m_trace
bool m_trace
Definition: Promoters.h:60
concurrency::DataNode
Definition: PrecedenceRulesGraph.h:553
concurrency::RunSimulator::RunSimulator
RunSimulator(EventSlot &slot, const Cause &cause)
Constructor.
Definition: Promoters.h:90
concurrency::RunSimulator::reset
void reset() override
Definition: Promoters.h:103
concurrency::DataReadyPromoter::visitEnter
bool visitEnter(AlgorithmNode &) const override
Definition: Promoters.cpp:24
concurrency::RunSimulator::m_cause
Cause m_cause
Definition: Promoters.h:106
concurrency::DecisionUpdater::DecisionUpdater
DecisionUpdater(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Definition: Promoters.h:51
concurrency::Supervisor::m_trace
bool m_trace
Definition: Promoters.h:83
Cause
Definition: PrecedenceRulesGraph.h:396
concurrency::DataReadyPromoter::DataReadyPromoter
DataReadyPromoter(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Definition: Promoters.h:24
concurrency::RunSimulator
Definition: Promoters.h:87