The Gaudi Framework  master (37c0b60a)
concurrency::DecisionUpdater Class Reference

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

Inheritance diagram for concurrency::DecisionUpdater:
Collaboration diagram for concurrency::DecisionUpdater:

Public Member Functions

 DecisionUpdater (EventSlot &slot, const Cause &cause, bool ifTrace=false)
 Constructor. More...
 
bool visit (AlgorithmNode &) override
 
virtual bool visit (DecisionNode &)
 
virtual bool visit (AlgorithmNode &)
 
virtual bool visit (DataNode &)
 
virtual bool visit (ConditionNode &)
 
- 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 bool visitEnter (DataNode &) const
 
virtual bool visit (DataNode &)
 
virtual bool visitEnter (ConditionNode &) const
 
virtual bool visit (ConditionNode &)
 
virtual void reset ()
 

Public Attributes

EventSlotm_slot
 
Cause m_cause
 
bool m_trace
 

Detailed Description

Definition at line 48 of file Promoters.h.

Constructor & Destructor Documentation

◆ DecisionUpdater()

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

Constructor.

Definition at line 51 of file Promoters.h.

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

Member Function Documentation

◆ visit() [1/5]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 29 of file IGraphVisitor.h.

29 { return true; }

◆ visit() [2/5]

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 104 of file Promoters.cpp.

104  {
105 
106  auto& states = m_slot->algsStates;
107  const AState& state = states[node.getAlgoIndex()];
108  const int decision = [state]() {
109  switch ( state ) {
110  case AState::EVTACCEPTED:
111  return 1;
112  case AState::EVTREJECTED:
113  return 0;
114  default:
115  return -1;
116  };
117  }();
118 
119  if ( -1 == decision ) { return false; }
120 
121  m_slot->controlFlowState[node.getNodeIndex()] = decision;
122 
123  auto promoter = DataReadyPromoter( *m_slot, m_cause, m_trace );
124  for ( const auto& output : node.getOutputDataNodes() )
125  for ( auto& consumer : output->getConsumers() ) consumer->accept( promoter );
126 
127  // propagate decision upward to active regions of the graph
129  auto& parents = node.getParentDecisionHubs();
130  if ( parents.size() == 1 ) {
131  parents[0]->accept( vis );
132  } else if ( m_slot->parentSlot ) {
133  auto scout = SubSlotScout( m_slot, node );
134  for ( auto& p : parents ) {
135  p->accept( scout );
136  if ( scout.reply() ) p->accept( vis );
137  scout.reset();
138  }
139  } else {
140  auto scout = ActiveLineageScout( m_slot, node );
141  for ( auto& p : parents ) {
142  p->accept( scout );
143  if ( scout.reply() ) p->accept( vis );
144  scout.reset();
145  }
146  }
147 
148  return true; // return true only if the algorithm produced a decision
149  }

◆ visit() [3/5]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 35 of file IGraphVisitor.h.

35 { return true; }

◆ visit() [4/5]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 32 of file IGraphVisitor.h.

32 { return true; }

◆ visit() [5/5]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 26 of file IGraphVisitor.h.

26 { return true; }

Member Data Documentation

◆ m_cause

Cause concurrency::DecisionUpdater::m_cause

Definition at line 59 of file Promoters.h.

◆ m_slot

EventSlot* concurrency::DecisionUpdater::m_slot

Definition at line 58 of file Promoters.h.

◆ m_trace

bool concurrency::DecisionUpdater::m_trace

Definition at line 60 of file Promoters.h.


The documentation for this class was generated from the following files:
concurrency::AState
AlgsExecutionStates::State AState
Definition: Promoters.cpp:21
concurrency::Supervisor
Definition: Promoters.h:64
concurrency::DecisionUpdater::m_slot
EventSlot * m_slot
Definition: Promoters.h:58
gaudirun.output
output
Definition: gaudirun.py:521
concurrency::DecisionUpdater::m_cause
Cause m_cause
Definition: Promoters.h:59
EventSlot::parentSlot
EventSlot * parentSlot
Pointer to parent slot (null for top level)
Definition: EventSlot.h:96
concurrency::DecisionUpdater::m_trace
bool m_trace
Definition: Promoters.h:60
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:87
compareRootHistos.state
state
Definition: compareRootHistos.py:496
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:85