| The Gaudi Framework v27r1

- 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/EFGraphVisitors.h>`

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

## Public Member Functions
| RunSimulator (const int &slotNum)
| Constructor. More...
virtual | ~RunSimulator ()
| Destructor. More...
virtual bool | visitEnter (DecisionNode &node) const
virtual bool | visit (DecisionNode &node)
virtual bool | visitLeave (DecisionNode &node) const
virtual bool | visitEnter (AlgorithmNode &node) const
virtual bool | visit (AlgorithmNode &node)
virtual void | reset ()
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 EFGraphVisitors.h.

## Constructor & Destructor Documentation

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

Constructor.

Definition at line 12 of file EFGraphVisitors.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

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

Destructor.

Definition at line 17 of file EFGraphVisitors.h.

17 {};

## Member Function Documentation

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

Implements concurrency::IGraphVisitor.

Definition at line 31 of file EFGraphVisitors.h.

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

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

Implements concurrency::IGraphVisitor.

Definition at line 14 of file EFGraphVisitors.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_isLazy) {
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 | ) |
| virtual

Implements concurrency::IGraphVisitor.

Definition at line 56 of file EFGraphVisitors.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
| virtual

Implements concurrency::IGraphVisitor.

Definition at line 6 of file EFGraphVisitors.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
| virtual

Implements concurrency::IGraphVisitor.

Definition at line 48 of file EFGraphVisitors.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
| virtual

Implements concurrency::IGraphVisitor.

Definition at line 38 of file EFGraphVisitors.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/EFGraphVisitors.h
- GaudiHive/src/EFGraphVisitors.cpp