| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

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

## Constructor & Destructor Documentation

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

Constructor.

Definition at line 139 of file PRGraphVisitors.h.

139 : m_slot( &slot ), m_cause( cause ){};
concurrency::RunSimulator::m_cause
Cause m_cause
Definition: PRGraphVisitors.h:155
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:152

## Member Function Documentation

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 152 of file PRGraphVisitors.h.

152 { m_nodesSucceeded = 0; };
concurrency::RunSimulator::m_nodesSucceeded
int m_nodesSucceeded
Definition: PRGraphVisitors.h:156

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 408 of file PRGraphVisitors.cpp.

409 {
410
411 // std::cout << "1-st level Decision: " << node.getNodeName() << std::endl;
412 bool allChildDecisionsResolved = true;
413 for ( auto child : node.getDaughters() ) {
414 int& childDecision = m_slot->controlFlowState[child->getNodeIndex()];
415
416 if ( childDecision == 1 && node.m_modeOR && node.m_modePromptDecision ) {
417 m_slot->controlFlowState[node.getNodeIndex()] = 1;
418 return true;
419 }
420
421 if ( childDecision == -1 ) {
422 allChildDecisionsResolved = false;
423 }
424 }
425
426 if ( allChildDecisionsResolved ) m_slot->controlFlowState[node.getNodeIndex()] = 1;
427
428 return allChildDecisionsResolved;
429 }
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:43
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:152

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 440 of file PRGraphVisitors.cpp.

441 {
442
443 auto& states = m_slot->algsStates;
444 int& decision = m_slot->controlFlowState[node.getNodeIndex()];
445
446 auto dataPromoter = DataReadyPromoter( *m_slot, m_cause );
447
448 if ( State::INITIAL == states[node.getAlgoIndex()] ) {
449 states.updateState( node.getAlgoIndex(), State::CONTROLREADY );
450 if ( dataPromoter.visit( node ) ) {
451 states.updateState( node.getAlgoIndex(), State::SCHEDULED );
452 states.updateState( node.getAlgoIndex(), State::EVTACCEPTED );
453 decision = 1;
454 ++m_nodesSucceeded;
455 // std::cout << "Algorithm decided: " << node.getNodeName() << std::endl;
456 return true;
457 }
458 } else if ( State::CONTROLREADY == states[node.getAlgoIndex()] && dataPromoter.visit( node ) ) {
459 states.updateState( node.getAlgoIndex(), State::SCHEDULED );
460 states.updateState( node.getAlgoIndex(), State::EVTACCEPTED );
461 decision = 1;
462 ++m_nodesSucceeded;
463 // std::cout << "Algorithm decided: " << node.getNodeName() << std::endl;
464 return true;
465 }
466
467 return false;
468 }
concurrency::RunSimulator::m_nodesSucceeded
int m_nodesSucceeded
Definition: PRGraphVisitors.h:156
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:37
concurrency::RunSimulator::m_cause
Cause m_cause
Definition: PRGraphVisitors.h:155
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:43
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:152

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 400 of file PRGraphVisitors.cpp.

401 {
402
403 if ( m_slot->controlFlowState[node.getNodeIndex()] != 1 ) return true;
404 return false;
405 }
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:43
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:152

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 432 of file PRGraphVisitors.cpp.

433 {
434
435 if ( m_slot->controlFlowState[node.getNodeIndex()] != 1 ) return true;
436 return false;
437 }
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:43
concurrency::RunSimulator::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:152

## Member Data Documentation

Cause concurrency::RunSimulator::m_cause

Definition at line 155 of file PRGraphVisitors.h.

int concurrency::RunSimulator::m_nodesSucceeded {0}

Definition at line 156 of file PRGraphVisitors.h.

EventSlot* concurrency::RunSimulator::m_slot

Definition at line 152 of file PRGraphVisitors.h.

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

- GaudiHive/src/PRGraphVisitors.h
- GaudiHive/src/PRGraphVisitors.cpp