| The Gaudi Framework v30r0 (c919700c)

- 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 413 of file PRGraphVisitors.cpp.

414 {
415
416 // std::cout << "1-st level Decision: " << node.getNodeName() << std::endl;
417 bool allChildDecisionsResolved = true;
418 for ( auto child : node.getDaughters() ) {
419 int& childDecision = m_slot->controlFlowState[child->getNodeIndex()];
420
421 if ( childDecision == 1 && node.m_modeOR && node.m_modePromptDecision ) {
422 m_slot->controlFlowState[node.getNodeIndex()] = 1;
423 return true;
424 }
425
426 if ( childDecision == -1 ) {
427 allChildDecisionsResolved = false;
428 }
429 }
430
431 if ( allChildDecisionsResolved ) m_slot->controlFlowState[node.getNodeIndex()] = 1;
432
433 return allChildDecisionsResolved;
434 }
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:37
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 445 of file PRGraphVisitors.cpp.

446 {
447
448 auto& states = m_slot->algsStates;
449 int& decision = m_slot->controlFlowState[node.getNodeIndex()];
450
451 auto dataPromoter = DataReadyPromoter( *m_slot, m_cause );
452
453 if ( State::INITIAL == states[node.getAlgoIndex()] ) {
454 states.updateState( node.getAlgoIndex(), State::CONTROLREADY );
455 if ( dataPromoter.visit( node ) ) {
456 states.updateState( node.getAlgoIndex(), State::SCHEDULED );
457 states.updateState( node.getAlgoIndex(), State::EVTACCEPTED );
458 decision = 1;
459 ++m_nodesSucceeded;
460 // std::cout << "Algorithm decided: " << node.getNodeName() << std::endl;
461 return true;
462 }
463 } else if ( State::CONTROLREADY == states[node.getAlgoIndex()] && dataPromoter.visit( node ) ) {
464 states.updateState( node.getAlgoIndex(), State::SCHEDULED );
465 states.updateState( node.getAlgoIndex(), State::EVTACCEPTED );
466 decision = 1;
467 ++m_nodesSucceeded;
468 // std::cout << "Algorithm decided: " << node.getNodeName() << std::endl;
469 return true;
470 }
471
472 return false;
473 }
concurrency::RunSimulator::m_nodesSucceeded
int m_nodesSucceeded
Definition: PRGraphVisitors.h:156
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:33
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:37
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 405 of file PRGraphVisitors.cpp.

406 {
407
408 if ( m_slot->controlFlowState[node.getNodeIndex()] != 1 ) return true;
409 return false;
410 }
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:37
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 437 of file PRGraphVisitors.cpp.

438 {
439
440 if ( m_slot->controlFlowState[node.getNodeIndex()] != 1 ) return true;
441 return false;
442 }
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:37
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