| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | List of all members
concurrency::DataReadyPromoter Class Reference

`#include <src/PRGraphVisitors.h>`

Inheritance diagram for concurrency::DataReadyPromoter:
[legend]
Collaboration diagram for concurrency::DataReadyPromoter:
[legend]

## Public Member Functions
| DataReadyPromoter (EventSlot &slot, const Cause &cause, bool ifTrace=false)
| Constructor. More...
bool | visitEnter (AlgorithmNode &) const override
bool | visit (AlgorithmNode &) override
bool | visitEnter (DataNode &) const override
bool | visit (DataNode &) override
bool | visitEnter (ConditionNode &) const override
bool | visit (ConditionNode &) override
Public Member Functions inherited from concurrency::IGraphVisitor
virtual | ~IGraphVisitor ()=default
virtual bool | visitEnter (DecisionNode &) const
virtual bool | visit (DecisionNode &)
virtual void | reset ()

## Public Attributes
EventSlot * | m_slot
Cause | m_cause
bool | m_trace

## Detailed Description

Definition at line 11 of file PRGraphVisitors.h.

## Constructor & Destructor Documentation

concurrency::DataReadyPromoter::DataReadyPromoter | ( | EventSlot & | slot,
|  | const Cause & | cause,
|  | bool | ifTrace = `false`
| ) |  |
| inline

Constructor.

Definition at line 15 of file PRGraphVisitors.h.

16 : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
concurrency::DataReadyPromoter::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:33
concurrency::DataReadyPromoter::m_trace
bool m_trace
Definition: PRGraphVisitors.h:35
concurrency::DataReadyPromoter::m_cause
Cause m_cause
Definition: PRGraphVisitors.h:34

## Member Function Documentation

bool concurrency::DataReadyPromoter::visit | ( | AlgorithmNode & | node | ) |
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 22 of file PRGraphVisitors.cpp.

23 {
24
25 bool result = true; // return true if this algorithm has no data inputs
26
27 for ( auto dataNode : node.getInputDataNodes() ) {
28
29 result = dataNode->accept( *this );
30
31 // With ConditionNodes, one may decide NOT to break here so that associated
32 // ConditionAlgorithms are scheduled ASAP. This behavior can be made configurable
33 if ( !result ) break; // skip checking other inputs if this input was not produced yet
34 }
35
36 if ( result ) {
37 m_slot->algsStates.updateState( node.getAlgoIndex(), State::DATAREADY ).ignore();
38
39 if ( m_trace ) {
40 auto sourceNode = ( m_cause.m_source == Cause::source::Task )
41 ? node.m_graph->getAlgorithmNode( m_cause.m_sourceName )
42 : nullptr;
43 node.m_graph->addEdgeToPrecTrace( sourceNode, &node );
44 }
45 }
46
47 // return true only if an algorithm is promoted to DR
48 return result;
49 }
Cause::source::Task
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:37
concurrency::DataReadyPromoter::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:33
Cause::m_source
source m_source
Definition: PrecedenceRulesGraph.h:316
concurrency::DataReadyPromoter::m_trace
bool m_trace
Definition: PRGraphVisitors.h:35
concurrency::DataReadyPromoter::m_cause
Cause m_cause
Definition: PRGraphVisitors.h:34
Cause::m_sourceName
std::string m_sourceName
Definition: PrecedenceRulesGraph.h:317
AlgsExecutionStates::updateState
StatusCode updateState(unsigned int iAlgo, State newState)
Definition: AlgsExecutionStates.cpp:8

bool concurrency::DataReadyPromoter::visit | ( | DataNode & | node | ) |
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 55 of file PRGraphVisitors.cpp.

56 {
57 /* Implements 'observer' strategy, i.e., only check if producer of this DataNode
58 * has been already executed or not */
59
60 bool result = false; // return false if this DataNode has no producers at all
61
62 for ( auto algoNode : node.getProducers() ) {
63 const auto& state = m_slot->algsStates[algoNode->getAlgoIndex()];
64 if ( State::EVTACCEPTED == state || State::EVTREJECTED == state ) {
65 result = true;
66 break; // skip checking other producers if one was found to be executed
67 }
68 }
69
70 // return true only if this DataNode is produced
71 return result;
72 }
compareRootHistos.state
state
Definition: compareRootHistos.py:422
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:37
concurrency::DataReadyPromoter::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:33

bool concurrency::DataReadyPromoter::visit | ( | ConditionNode & | node | ) |
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 85 of file PRGraphVisitors.cpp.

86 {
87 /* Implements 'requester' strategy, i.e., requests this ConditionNode to be loaded
88 * by its associated ConditionAlgorithm */
89
90 auto promoter = Supervisor( *m_slot, m_cause );
91
92 for ( auto condAlg : node.getProducers() ) condAlg->accept( promoter );
93
94 // this method is called if, and only if, this ConditionNode is not yet produced.
95 // thus, by definition, this ConditionNode is not yet available at this moment
96 return false;
97 }
concurrency::DataReadyPromoter::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:33
concurrency::DataReadyPromoter::m_cause
Cause m_cause
Definition: PRGraphVisitors.h:34

bool concurrency::DataReadyPromoter::visitEnter | ( | AlgorithmNode & | node | ) | const
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 13 of file PRGraphVisitors.cpp.

14 {
15
16 if ( State::CONTROLREADY != m_slot->algsStates[node.getAlgoIndex()] ) return false;
17
18 return true;
19 }
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:37
concurrency::DataReadyPromoter::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:33

bool concurrency::DataReadyPromoter::visitEnter | ( | DataNode & |  | ) | const
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 52 of file PRGraphVisitors.cpp.

52 { return true; }

bool concurrency::DataReadyPromoter::visitEnter | ( | ConditionNode & | node | ) | const
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 75 of file PRGraphVisitors.cpp.

76 {
77
78 if ( node.m_condSvc->isValidID( *( m_slot->eventContext ), node.getPath() ) )
79 return false; // do not enter this ConditionNode if the condition has bee already loaded
80
81 return true;
82 }
EventSlot::eventContext
EventContext * eventContext
Cache for the eventContext.
Definition: EventSlot.h:32
concurrency::DataReadyPromoter::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:33

## Member Data Documentation

Cause concurrency::DataReadyPromoter::m_cause

Definition at line 34 of file PRGraphVisitors.h.

EventSlot* concurrency::DataReadyPromoter::m_slot

Definition at line 33 of file PRGraphVisitors.h.

bool concurrency::DataReadyPromoter::m_trace

Definition at line 35 of file PRGraphVisitors.h.

The documentation for this class was generated from the following files:

- GaudiHive/src/PRGraphVisitors.h
- GaudiHive/src/PRGraphVisitors.cpp