The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
concurrency::DataReadyPromoter Class Reference

#include </builds/gaudi/Gaudi/GaudiHive/src/PRGraph/Visitors/Promoters.h>

Inheritance diagram for concurrency::DataReadyPromoter:
Collaboration diagram for concurrency::DataReadyPromoter:

Public Member Functions

 DataReadyPromoter (EventSlot &slot, const Cause &cause, bool ifTrace=false)
 Constructor.
 
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
 
virtual bool visit (DecisionNode &)
 
virtual bool visitEnter (DecisionNode &) const
 
- Public Member Functions inherited from concurrency::IGraphVisitor
virtual ~IGraphVisitor ()=default
 
virtual void reset ()
 

Public Attributes

EventSlotm_slot
 
Cause m_cause
 
bool m_trace
 

Detailed Description

Definition at line 20 of file Promoters.h.

Constructor & Destructor Documentation

◆ DataReadyPromoter()

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

Constructor.

Definition at line 23 of file Promoters.h.

24 : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ) {}

Member Function Documentation

◆ visit() [1/4]

bool concurrency::DataReadyPromoter::visit ( AlgorithmNode & node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 32 of file Promoters.cpp.

32 {
33
34 bool result = true; // return true if this algorithm has no data inputs
35
36 for ( auto dataNode : node.getInputDataNodes() ) {
37
38 result = dataNode->accept( *this );
39
40 // With ConditionNodes, one may decide NOT to break here so that associated
41 // ConditionAlgorithms are scheduled ASAP. This behavior can be made configurable
42 if ( !result ) break; // skip checking other inputs if this input was not produced yet
43 }
44
45 if ( result ) {
46 m_slot->algsStates.set( node.getAlgoIndex(), AState::DATAREADY ).ignore();
47
48 if ( m_trace ) {
49 auto sourceNode = ( m_cause.m_source == Cause::source::Task )
50 ? node.m_graph->getAlgorithmNode( m_cause.m_sourceName )
51 : nullptr;
52 node.m_graph->addEdgeToPrecTrace( sourceNode, &node );
53 }
54 }
55
56 // return true only if an algorithm is promoted to DR
57 return result;
58 }

◆ visit() [2/4]

bool concurrency::DataReadyPromoter::visit ( ConditionNode & node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 90 of file Promoters.cpp.

90 {
91 /* Implements 'requester' strategy, i.e., requests this ConditionNode to be loaded
92 * by its associated ConditionAlgorithm */
93
94 auto promoter = Supervisor( *m_slot, m_cause, m_trace );
95
96 for ( auto condAlg : node.getProducers() ) condAlg->accept( promoter );
97
98 // this method is called if, and only if, this ConditionNode is not yet produced.
99 // thus, by definition, this ConditionNode is not yet available at this moment
100 return false;
101 }

◆ visit() [3/4]

bool concurrency::DataReadyPromoter::visit ( DataNode & node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 64 of file Promoters.cpp.

64 {
65 /* Implements 'observer' strategy, i.e., only check if producer of this DataNode
66 * has been already executed or not */
67
68 auto const& producers = node.getProducers();
69 for ( auto algoNode : producers ) {
70 const auto& state = m_slot->algsStates[algoNode->getAlgoIndex()];
71 if ( AState::EVTACCEPTED == state || AState::EVTREJECTED == state ) {
72 return true; // skip checking other producers if one was found to be executed
73 }
74 }
75
76 // return true only if this DataNode is produced
77 return false;
78 }

◆ visit() [4/4]

virtual bool concurrency::IGraphVisitor::visit ( DecisionNode & )
inlinevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 25 of file IGraphVisitor.h.

25{ return true; }

◆ visitEnter() [1/4]

bool concurrency::DataReadyPromoter::visitEnter ( AlgorithmNode & node) const
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 24 of file Promoters.cpp.

24 {
25
26 if ( AState::CONTROLREADY != m_slot->algsStates[node.getAlgoIndex()] ) return false;
27
28 return true;
29 }

◆ visitEnter() [2/4]

bool concurrency::DataReadyPromoter::visitEnter ( ConditionNode & node) const
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 81 of file Promoters.cpp.

81 {
82
83 if ( node.m_condSvc->isValidID( *( m_slot->eventContext ), node.name() ) )
84 return false; // do not enter this ConditionNode if the condition has bee already loaded
85
86 return true;
87 }

◆ visitEnter() [3/4]

bool concurrency::DataReadyPromoter::visitEnter ( DataNode & ) const
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 61 of file Promoters.cpp.

61{ return true; }

◆ visitEnter() [4/4]

virtual bool concurrency::IGraphVisitor::visitEnter ( DecisionNode & ) const
inlinevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 24 of file IGraphVisitor.h.

24{ return true; }

Member Data Documentation

◆ m_cause

Cause concurrency::DataReadyPromoter::m_cause

Definition at line 42 of file Promoters.h.

◆ m_slot

EventSlot* concurrency::DataReadyPromoter::m_slot

Definition at line 41 of file Promoters.h.

◆ m_trace

bool concurrency::DataReadyPromoter::m_trace

Definition at line 43 of file Promoters.h.


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