The Gaudi Framework  v33r0 (d5ea422b)
Promoters.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 
105  EventSlot* m_slot;
108  };
109 } // namespace concurrency
110 
111 #endif /* PROMOTERS_H_ */
EventSlot * m_slot
Definition: Promoters.h:81
Class representing an event slot.
Definition: EventSlot.h:24
bool visit(AlgorithmNode &) override
Definition: Promoters.cpp:32
void reset() override
Definition: Promoters.h:103
virtual bool visit(DecisionNode &)
Definition: IGraphVisitor.h:26
virtual bool visitEnter(DecisionNode &) const
Definition: IGraphVisitor.h:25
bool visit(DecisionNode &) override
Definition: Promoters.cpp:366
bool visitEnter(AlgorithmNode &) const override
Definition: Promoters.cpp:24
bool visit(AlgorithmNode &) override
Definition: Promoters.cpp:114
RunSimulator(EventSlot &slot, const Cause &cause)
Constructor.
Definition: Promoters.h:90
DataReadyPromoter(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Definition: Promoters.h:24
bool visitEnter(DecisionNode &) const override
Definition: Promoters.cpp:163
bool visit(DecisionNode &) override
Definition: Promoters.cpp:170
bool visitEnter(DecisionNode &) const override
Definition: Promoters.cpp:359
DecisionUpdater(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Definition: Promoters.h:51
Supervisor(EventSlot &slot, const Cause &cause, bool ifTrace=false)
Constructor.
Definition: Promoters.h:67