| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Public Attributes | List of all members
concurrency::RunSimulator Class Reference

`#include <src/PRGraph/Visitors/Promoters.h>`

Inheritance diagram for concurrency::RunSimulator:
[legend]
Collaboration diagram for concurrency::RunSimulator:
[legend]

## Public Member Functions
| RunSimulator (EventSlot &slot, const Cause &cause)
| Constructor. More...
bool | visitEnter (DecisionNode &) const override
bool | visit (DecisionNode &) override
bool | visitEnter (AlgorithmNode &) const override
bool | visit (AlgorithmNode &) override
void | reset () override
virtual bool | visit (DecisionNode &)
virtual bool | visit (AlgorithmNode &)
virtual bool | visit (DataNode &)
virtual bool | visit (ConditionNode &)
virtual bool | visitEnter (DecisionNode &) const
virtual bool | visitEnter (AlgorithmNode &) const
virtual bool | visitEnter (DataNode &) const
virtual bool | visitEnter (ConditionNode &) const
Public Member Functions inherited from concurrency::IGraphVisitor
virtual | ~IGraphVisitor ()=default
virtual bool | visitEnter (DataNode &) const
virtual bool | visit (DataNode &)
virtual bool | visitEnter (ConditionNode &) const
virtual bool | visit (ConditionNode &)

## Public Attributes
EventSlot * | m_slot
Cause | m_cause
int | m_nodesSucceeded {0}

## Detailed Description

Definition at line 77 of file Promoters.h.

## Constructor & Destructor Documentation

## ◆ RunSimulator()

concurrency::RunSimulator::RunSimulator | ( | EventSlot & | slot,
|  | const Cause & | cause
| ) |  |
| inline

Constructor.

Definition at line 80 of file Promoters.h.

80 : m_slot( &slot ), m_cause( cause ){};
concurrency::RunSimulator::m_cause
Cause m_cause
Definition: Promoters.h:96
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: Promoters.h:93

## Member Function Documentation

## ◆ reset()

void concurrency::RunSimulator::reset | ( |  | ) |
| inline override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 93 of file Promoters.h.

93 { m_nodesSucceeded = 0; };
concurrency::RunSimulator::m_nodesSucceeded
int m_nodesSucceeded
Definition: Promoters.h:97

## ◆ visit() [1/6]

virtual bool concurrency::IGraphVisitor::visit
| inline

Definition at line 22 of file IGraphVisitor.h.

22 { return true; };

## ◆ visit() [2/6]

virtual bool concurrency::IGraphVisitor::visit
| inline

Definition at line 25 of file IGraphVisitor.h.

25 { return true; };

## ◆ visit() [3/6]

virtual bool concurrency::IGraphVisitor::visit
| inline

Definition at line 16 of file IGraphVisitor.h.

16 { return true; };

## ◆ visit() [4/6]

virtual bool concurrency::IGraphVisitor::visit
| inline

Definition at line 19 of file IGraphVisitor.h.

19 { return true; };

## ◆ visit() [5/6]

bool concurrency::RunSimulator::visit | ( | DecisionNode & | node | ) |
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 356 of file Promoters.cpp.

356 {
357
358 bool allChildDecisionsResolved = true;
359
360 for ( const auto& child : node.getDaughters() ) {
361
362 child->accept( *this );
363
364 int childDecision = m_slot->controlFlowState[child->getNodeIndex()];
365 if ( childDecision == -1 ) allChildDecisionsResolved = false;
366
367 // process children sequentially if their decision hub is sequential
368 if ( !node.m_modeConcurrent && childDecision == -1 ) return false;
369
370 if ( childDecision == 1 && node.m_modeOR && node.m_modePromptDecision ) {
371 m_slot->controlFlowState[node.getNodeIndex()] = 1;
372
373 // if a decision was made for this node, propagate the result upwards
374 for ( auto parent : node.m_parents ) { parent->accept( *this ); }
375 return true;
376 }
377 }
378
379 if ( allChildDecisionsResolved ) {
380 m_slot->controlFlowState[node.getNodeIndex()] = 1;
381
382 // if a decision was made for this node, propagate the result upwards
383 for ( auto parent : node.m_parents ) { parent->accept( *this ); }
384 }
385
386 return allChildDecisionsResolved;
387 }
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:77
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: Promoters.h:93

## ◆ visit() [6/6]

bool concurrency::RunSimulator::visit | ( | AlgorithmNode & | node | ) |
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 397 of file Promoters.cpp.

397 {
398
399 auto& states = m_slot->algsStates;
400 int& decision = m_slot->controlFlowState[node.getNodeIndex()];
401
402 auto dataPromoter = DataReadyPromoter( *m_slot, m_cause );
403
404 if ( AState::INITIAL == states[node.getAlgoIndex()] ) {
405 states.set( node.getAlgoIndex(), AState::CONTROLREADY );
406 if ( dataPromoter.visit( node ) ) {
407 states.set( node.getAlgoIndex(), AState::SCHEDULED );
408 states.set( node.getAlgoIndex(), AState::EVTACCEPTED );
409 decision = 1;
410 ++m_nodesSucceeded;
411 // std::cout << "Algorithm decided: " << node.getNodeName() << std::endl;
412 return true;
413 }
414 } else if ( AState::CONTROLREADY == states[node.getAlgoIndex()] && dataPromoter.visit( node ) ) {
415 states.set( node.getAlgoIndex(), AState::SCHEDULED );
416 states.set( node.getAlgoIndex(), AState::EVTACCEPTED );
417 decision = 1;
418 ++m_nodesSucceeded;
419 // std::cout << "Algorithm decided: " << node.getNodeName() << std::endl;
420 return true;
421 }
422
423 return false;
424 }
concurrency::RunSimulator::m_nodesSucceeded
int m_nodesSucceeded
Definition: Promoters.h:97
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:77
concurrency::RunSimulator::m_cause
Cause m_cause
Definition: Promoters.h:96
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: Promoters.h:93
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:75

## ◆ visitEnter() [1/6]

virtual bool concurrency::IGraphVisitor::visitEnter
| inline

Definition at line 18 of file IGraphVisitor.h.

18 { return true; };

## ◆ visitEnter() [2/6]

virtual bool concurrency::IGraphVisitor::visitEnter
| inline

Definition at line 21 of file IGraphVisitor.h.

21 { return true; };

## ◆ visitEnter() [3/6]

virtual bool concurrency::IGraphVisitor::visitEnter
| inline

Definition at line 24 of file IGraphVisitor.h.

24 { return true; };

## ◆ visitEnter() [4/6]

virtual bool concurrency::IGraphVisitor::visitEnter
| inline

Definition at line 15 of file IGraphVisitor.h.

15 { return true; };

## ◆ visitEnter() [5/6]

bool concurrency::RunSimulator::visitEnter | ( | DecisionNode & | node | ) | const
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 349 of file Promoters.cpp.

349 {
350
351 if ( m_slot->controlFlowState[node.getNodeIndex()] != 1 ) return true;
352 return false;
353 }
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:77
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: Promoters.h:93

## ◆ visitEnter() [6/6]

bool concurrency::RunSimulator::visitEnter | ( | AlgorithmNode & | node | ) | const
| override virtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 390 of file Promoters.cpp.

390 {
391
392 if ( m_slot->controlFlowState[node.getNodeIndex()] != 1 ) return true;
393 return false;
394 }
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:77
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: Promoters.h:93

## Member Data Documentation

## ◆ m_cause

Cause concurrency::RunSimulator::m_cause

Definition at line 96 of file Promoters.h.

## ◆ m_nodesSucceeded

int concurrency::RunSimulator::m_nodesSucceeded {0}

Definition at line 97 of file Promoters.h.

## ◆ m_slot

EventSlot* concurrency::RunSimulator::m_slot

Definition at line 93 of file Promoters.h.

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

- GaudiHive/src/PRGraph/Visitors/Promoters.h
- GaudiHive/src/PRGraph/Visitors/Promoters.cpp