| 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::Supervisor Class Reference

`#include <src/PRGraphVisitors.h>`

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

## Public Member Functions
| Supervisor (const int &slotNum)
| Constructor. More...
| ~Supervisor () override
| Destructor. More...
bool | visitEnter (DecisionNode &node) const override
bool | visit (DecisionNode &node) override
bool | visitLeave (DecisionNode &) 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 65 of file PRGraphVisitors.h.

## Constructor & Destructor Documentation

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

Constructor.

Definition at line 68 of file PRGraphVisitors.h.

68 {
69 m_nodesSucceeded = 0;
70 m_slotNum = slotNum;
71 };
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24
concurrency::IGraphVisitor::m_nodesSucceeded
int m_nodesSucceeded
Definition: IGraphVisitor.h:23

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

Destructor.

Definition at line 73 of file PRGraphVisitors.h.

73 {}

## Member Function Documentation

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

Implements concurrency::IGraphVisitor.

Definition at line 87 of file PRGraphVisitors.h.

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

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

Implements concurrency::IGraphVisitor.

Definition at line 157 of file PRGraphVisitors.cpp.

157 {
158
159 bool foundNonResolvedChild = false;
160 bool foundNegativeChild = false;
161 bool foundPositiveChild = false;
162 int decision = -1;
163
164 for (auto child : node.getDaughters()) {
165 int& childDecision = child->m_graph->getNodeDecisions(m_slotNum)[child->getNodeIndex()];
166
167 if (childDecision == -1)
168 foundNonResolvedChild = true;
169 else if (childDecision == 1)
170 foundPositiveChild = true;
171 else
172 foundNegativeChild = true;
173
174 if (node.m_modePromptDecision) {
175 if (node.m_modeOR && foundPositiveChild) {
176 decision = 1;
177 break;
178 } else if (!node.m_modeOR && foundNegativeChild) {
179 decision = 0;
180 break;
181 }
182 } else {
183 if (foundNonResolvedChild)
184 break;
185 }
186 } // end monitoring children
187
188 if (!foundNonResolvedChild && decision == -1) {
189 if (node.m_modeOR) // OR
190 if (foundPositiveChild) decision = 1;
191 else decision = 0;
192 else // AND
193 if (foundNegativeChild) decision = 0;
194 else decision = 1;
195 }
196
197 if (node.m_allPass && !foundNonResolvedChild)
198 decision = 1;
199
200 if (decision != -1) {
201 node.m_graph->getNodeDecisions(m_slotNum)[node.getNodeIndex()] = decision;
202 return true;
203 }
204 return false;
205 }
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24

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

Implements concurrency::IGraphVisitor.

Definition at line 218 of file PRGraphVisitors.cpp.

218 {
219
220 bool result = false;
221
222 auto& decisions = node.m_graph->getNodeDecisions(m_slotNum);
223 auto& states = node.m_graph->getAlgoStates(m_slotNum);
224
225 // Try to shift an algorithm with I->CF, and then, if successful, with CF->DF
226 if (node.promoteToControlReadyState(m_slotNum,states,decisions))
227 result = node.promoteToDataReadyState(m_slotNum);
228
229 //returns true only when an algorithm is DF-ready
230 // i.e., the visitor reached its final goal with the algorithm
231 return result;
232 }
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24

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

Implements concurrency::IGraphVisitor.

Definition at line 149 of file PRGraphVisitors.cpp.

149 {
150
151 if (node.m_graph->getNodeDecisions(m_slotNum)[node.getNodeIndex()] != -1)
152 return false;
153 return true;
154 }
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24

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

Implements concurrency::IGraphVisitor.

Definition at line 210 of file PRGraphVisitors.cpp.

210 {
211
212 if (node.m_graph->getNodeDecisions(m_slotNum)[node.getNodeIndex()] != -1)
213 return false;
214 return true;
215 }
concurrency::IGraphVisitor::m_slotNum
int m_slotNum
Definition: IGraphVisitor.h:24

bool concurrency::Supervisor::visitLeave | ( | DecisionNode & |  | ) | const
| inline override virtual

Implements concurrency::IGraphVisitor.

Definition at line 79 of file PRGraphVisitors.h.

79 {return true;};

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

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