The Gaudi Framework  v30r2 (9eca68f7)
concurrency::DecisionUpdater Class Reference

#include <src/PRGraphVisitors.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
 
- 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 38 of file PRGraphVisitors.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 42 of file PRGraphVisitors.h.

Member Function Documentation

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 115 of file PRGraphVisitors.cpp.

116  {
117 
118  auto& states = m_slot->algsStates;
119  const State& state = states[node.getAlgoIndex()];
120  int decision = -1;
121 
122  if ( true == node.isOptimist() )
123  decision = 1;
124  else if ( State::EVTACCEPTED == state )
125  decision = !node.isLiar();
126  else if ( State::EVTREJECTED == state )
127  decision = node.isLiar();
128 
129  if ( -1 != decision ) {
130 
131  m_slot->controlFlowState[node.getNodeIndex()] = decision;
132 
133  auto promoter = DataReadyPromoter( *m_slot, m_cause, m_trace );
134  for ( const auto& output : node.getOutputDataNodes() )
135  for ( auto& consumer : output->getConsumers() ) consumer->accept( promoter );
136 
138  for ( auto& p : node.getParentDecisionHubs() ) p->accept( vis );
139 
140  return true; // return true only if the algorithm produced a decision
141  }
142 
143  return false;
144  }
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:50
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:54
State
Execution states of the algorithms.

Member Data Documentation

Cause concurrency::DecisionUpdater::m_cause

Definition at line 50 of file PRGraphVisitors.h.

EventSlot* concurrency::DecisionUpdater::m_slot

Definition at line 49 of file PRGraphVisitors.h.

bool concurrency::DecisionUpdater::m_trace

Definition at line 51 of file PRGraphVisitors.h.


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