| The Gaudi Framework v28r2p1 (f1a77ff4)

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

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

Public Member Functions | 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 (const int &slotNum)
| Constructor. More...
| ~RunSimulator () override
| Destructor. More...
bool | visitEnter (DecisionNode &node) const override
bool | visit (DecisionNode &node) override
bool | visitLeave (DecisionNode &node) const override
bool | visitEnter (AlgorithmNode &node) const override
bool | visit (AlgorithmNode &node) override
void | reset () override
Public Member Functions inherited from concurrency::IGraphVisitor
virtual | ~IGraphVisitor ()

## Additional Inherited Members
Public Attributes inherited from concurrency::IGraphVisitor
int | m_nodesSucceeded
int | m_slotNum

## Detailed Description

Definition at line 9 of file PRGraphVisitors.h.

## Constructor & Destructor Documentation

concurrency::RunSimulator::RunSimulator | ( | const int & | slotNum | ) |
| inline

Constructor.

Definition at line 12 of file PRGraphVisitors.h.

12 {
13 m_nodesSucceeded = 0;
14 m_slotNum = slotNum;
15 };
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24
concurrency::IGraphVisitor::m_nodesSucceeded
int m_nodesSucceeded
Definition: IGraphVisitor.h:23

concurrency::RunSimulator::~RunSimulator | ( |  | ) |
| inline override

Destructor.

Definition at line 17 of file PRGraphVisitors.h.

17 {}

## Member Function Documentation

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

Implements concurrency::IGraphVisitor.

Definition at line 31 of file PRGraphVisitors.h.

31 { m_nodesSucceeded = 0; }
concurrency::IGraphVisitor::m_nodesSucceeded
int m_nodesSucceeded
Definition: IGraphVisitor.h:23

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

Implements concurrency::IGraphVisitor.

Definition at line 14 of file PRGraphVisitors.cpp.

14 {
15
16 //std::cout << "1-st level Decision: " << node.getNodeName() << std::endl;
17 bool allChildDecisionsResolved = true;
18 for (auto child : node.getDaughters()) {
19 int& childDecision = child->m_graph->getNodeDecisions(m_slotNum)[child->getNodeIndex()];
20
21 if (childDecision == 1 && node.m_modeOR && node.m_modePromptDecision) {
22 node.m_graph->getNodeDecisions(m_slotNum)[node.getNodeIndex()] = 1;
23 return true;
24 }
25
26 if (childDecision == -1) {
27 allChildDecisionsResolved = false;
28 }
29 }
30
31 if (allChildDecisionsResolved)
32 node.m_graph->getNodeDecisions(m_slotNum)[node.getNodeIndex()] = 1;
33
34 return allChildDecisionsResolved;
35 }
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24

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

Implements concurrency::IGraphVisitor.

Definition at line 56 of file PRGraphVisitors.cpp.

56 {
57
58 std::vector<int>& decisions = node.m_graph->getNodeDecisions(m_slotNum);
59 AlgsExecutionStates& states = node.m_graph->getAlgoStates(m_slotNum);
60 int& decision = decisions[node.getNodeIndex()];
61
62 if (State::INITIAL == states[node.getAlgoIndex()]) {
63 states.updateState(node.getAlgoIndex(), State::CONTROLREADY);
64 if (node.dataDependenciesSatisfied(m_slotNum)) {
65 states.updateState(node.getAlgoIndex(), State::DATAREADY);
66 states.updateState(node.getAlgoIndex(), State::SCHEDULED);
67 states.updateState(node.getAlgoIndex(), State::EVTACCEPTED);
68 decision = 1;
69 ++m_nodesSucceeded;
70 //std::cout << "Algorithm decided: " << node.getNodeName() << std::endl;
71 return true;
72 }
73 } else if (State::CONTROLREADY == states[node.getAlgoIndex()] && node.dataDependenciesSatisfied(m_slotNum)) {
74 states.updateState(node.getAlgoIndex(), State::DATAREADY);
75 states.updateState(node.getAlgoIndex(), State::SCHEDULED);
76 states.updateState(node.getAlgoIndex(), State::EVTACCEPTED);
77 decision = 1;
78 ++m_nodesSucceeded;
79 //std::cout << "Algorithm decided: " << node.getNodeName() << std::endl;
80 return true;
81 }
82
83 return false;
84 }
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24
AlgsExecutionStates
The AlgsExecutionStates encodes the state machine for the execution of algorithms within a single eve...
Definition: AlgsExecutionStates.h:28
std::vector< int >
concurrency::IGraphVisitor::m_nodesSucceeded
int m_nodesSucceeded
Definition: IGraphVisitor.h:23
AlgsExecutionStates::updateState
StatusCode updateState(unsigned int iAlgo, State newState)
Definition: AlgsExecutionStates.cpp:14

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

Implements concurrency::IGraphVisitor.

Definition at line 6 of file PRGraphVisitors.cpp.

6 {
7
8 if (node.m_graph->getNodeDecisions(m_slotNum)[node.getNodeIndex()] != 1)
9 return true;
10 return false;
11 }
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24

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

Implements concurrency::IGraphVisitor.

Definition at line 48 of file PRGraphVisitors.cpp.

48 {
49
50 if (node.m_graph->getNodeDecisions(m_slotNum)[node.getNodeIndex()] != 1)
51 return true;
52 return false;
53 }
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24

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

Implements concurrency::IGraphVisitor.

Definition at line 38 of file PRGraphVisitors.cpp.

38 {
39
40 if (node.m_graph->getNodeDecisions(m_slotNum)[node.getNodeIndex()] != 1)
41 return true;
42 return false;
43 }
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24

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

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