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

#include <src/PRGraphVisitors.h>

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

Public Member Functions

 DecisionUpdater (EventSlot &slot)
 Constructor. More...
 
bool visit (AlgorithmNode &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 bool visitEnter (DataNode &) const
 
virtual bool visit (DataNode &)
 
virtual void reset ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 27 of file PRGraphVisitors.h.

Constructor & Destructor Documentation

concurrency::DecisionUpdater::DecisionUpdater ( EventSlot slot)
inline

Constructor.

Definition at line 30 of file PRGraphVisitors.h.

30  {
31  m_nodesSucceeded = 0;
32  m_slot = &slot;
33  };

Member Function Documentation

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 50 of file PRGraphVisitors.cpp.

50  {
51 
52  auto& states = m_slot->algsStates;
53  const State& state = states[node.getAlgoIndex()];
54  int decision = -1;
55 
56  if ( true == node.isOptimist() )
57  decision = 1;
58  else if ( State::EVTACCEPTED == state )
59  decision = !node.isLiar();
60  else if ( State::EVTREJECTED == state )
61  decision = node.isLiar();
62 
63  if ( -1 != decision ) {
64 
65  m_slot->controlFlowState[node.getNodeIndex()] = decision;
66 
67  auto promoter = DataReadyPromoter(*m_slot);
68  for ( auto output : node.getOutputDataNodes() )
69  for ( auto consumer : output->getConsumers() )
70  if (State::CONTROLREADY == states[consumer->getAlgoIndex()])
71  consumer->accept(promoter);
72 
73  auto vis = concurrency::Supervisor( *m_slot );
74  for ( auto p : node.getParentDecisionHubs() )
75  p->accept(vis);
76 
77  return true; // return true only if the algorithm produced a decision
78  }
79 
80  return false;
81  }
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:37
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:43
State
Execution states of the algorithms.

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