The Gaudi Framework  v28r3 (cc1cf868)
concurrency::DataReadyPromoter Class Reference

#include <src/PRGraphVisitors.h>

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

Public Member Functions

 DataReadyPromoter (EventSlot &slot)
 Constructor. More...
 
bool visit (AlgorithmNode &node) override
 
bool visitEnter (DataNode &node) const override
 
bool visit (DataNode &node) override
 
- Public Member Functions inherited from concurrency::IGraphVisitor
virtual ~IGraphVisitor ()=default
 
virtual bool visitEnter (DecisionNode &) const
 
virtual bool visit (DecisionNode &)
 
virtual bool visitEnter (AlgorithmNode &) const
 
virtual void reset ()
 

Additional Inherited Members

- Public Attributes inherited from concurrency::IGraphVisitor
int m_nodesSucceeded
 
EventSlotm_slot
 

Detailed Description

Definition at line 9 of file PRGraphVisitors.h.

Constructor & Destructor Documentation

concurrency::DataReadyPromoter::DataReadyPromoter ( EventSlot slot)
inline

Constructor.

Definition at line 12 of file PRGraphVisitors.h.

12  {
13  m_nodesSucceeded = 0;
14  m_slot = &slot;
15  };

Member Function Documentation

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 9 of file PRGraphVisitors.cpp.

9  {
10 
11  bool result = true; // return true if an algorithm has no data inputs
12 
13  for ( auto dataNode : node.getInputDataNodes() ) {
14 
15  result = visit(*dataNode);
16 
17  if (!result) break; // skip checking other inputs if this input was not produced yet
18  }
19 
20  if (result)
21  m_slot->algsStates.updateState( node.getAlgoIndex(), State::DATAREADY ).ignore();
22 
23  // return true only if an algorithm is promoted to DR
24  return result;
25  }
bool visit(AlgorithmNode &node) override
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:37
StatusCode updateState(unsigned int iAlgo, State newState)
bool concurrency::DataReadyPromoter::visit ( DataNode node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 33 of file PRGraphVisitors.cpp.

33  {
34 
35  bool result = false; // return false if the input has no producers at all
36 
37  for ( auto algoNode : node.getProducers() ) {
38  const auto& state = m_slot->algsStates[algoNode->getAlgoIndex()];
39  if ( State::EVTACCEPTED == state || State::EVTREJECTED == state ) {
40  result = true;
41  break; // skip checking other producers if one was found to be executed
42  }
43  }
44 
45  // return true only if this DataNode is produced
46  return result;
47  }
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:37
bool concurrency::DataReadyPromoter::visitEnter ( DataNode node) const
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 28 of file PRGraphVisitors.cpp.

28  {
29  return true;
30  }

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