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

`#include <src/PRGraphVisitors.h>`

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

## Public Member Functions
| Supervisor (EventSlot &slot, const Cause &cause, bool ifTrace=false)
| Constructor. More...
bool | visitEnter (DecisionNode &) const override
bool | visit (DecisionNode &) override
bool | visitEnter (AlgorithmNode &) const override
bool | visit (AlgorithmNode &) 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 &)
virtual void | reset ()

## Public Attributes
EventSlot * | m_slot
Cause | m_cause
bool | m_trace

## Detailed Description

Definition at line 54 of file PRGraphVisitors.h.

## Constructor & Destructor Documentation

concurrency::Supervisor::Supervisor | ( | EventSlot & | slot,
|  | const Cause & | cause,
|  | bool | ifTrace = `false`
| ) |  |
| inline

Constructor.

Definition at line 58 of file PRGraphVisitors.h.

59 : m_slot( &slot ), m_cause( cause ), m_trace( ifTrace ){};
concurrency::Supervisor::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:72
concurrency::Supervisor::m_trace
bool m_trace
Definition: PRGraphVisitors.h:74
concurrency::Supervisor::m_cause
Cause m_cause
Definition: PRGraphVisitors.h:73

## Member Function Documentation

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 140 of file PRGraphVisitors.cpp.

141 {
142
143 bool foundNonResolvedChild = false;
144 bool foundNegativeChild = false;
145 bool foundPositiveChild = false;
146 int decision = -1;
147
148 for ( auto child : node.getDaughters() ) {
149 int& childDecision = m_slot->controlFlowState[child->getNodeIndex()];
150
151 if ( childDecision == -1 )
152 foundNonResolvedChild = true;
153 else if ( childDecision == 1 )
154 foundPositiveChild = true;
155 else
156 foundNegativeChild = true;
157
158 if ( node.m_modePromptDecision ) {
159 if ( node.m_modeOR && foundPositiveChild ) {
160 decision = 1;
161 break;
162 } else if ( !node.m_modeOR && foundNegativeChild ) {
163 decision = 0;
164 break;
165 }
166 } else {
167 if ( foundNonResolvedChild ) break;
168 }
169 } // end monitoring children
170
171 if ( !foundNonResolvedChild && decision == -1 ) {
172 if ( node.m_modeOR ) { // OR
173 if ( foundPositiveChild )
174 decision = 1;
175 else
176 decision = 0;
177 } else { // AND
178 if ( foundNegativeChild )
179 decision = 0;
180 else
181 decision = 1;
182 }
183 }
184
185 if ( node.m_inverted && decision == 1 )
186 decision = 0;
187 else if ( node.m_inverted && decision == 0 )
188 decision = 1;
189
190 if ( node.m_allPass && !foundNonResolvedChild ) decision = 1;
191
192 if ( decision != -1 ) {
193 m_slot->controlFlowState[node.getNodeIndex()] = decision;
194 return true;
195 }
196 return false;
197 }
concurrency::Supervisor::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:72
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:37

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 208 of file PRGraphVisitors.cpp.

209 {
210
211 bool result = false;
212
213 auto& states = m_slot->algsStates;
214 auto& state = states[node.getAlgoIndex()];
215
216 // Promote with INITIAL->CR
217 if ( State::INITIAL == state ) states.updateState( node.getAlgoIndex(), State::CONTROLREADY ).ignore();
218
219 // Try to promote with CR->DR
220 if ( State::CONTROLREADY == state ) {
221 auto promoter = DataReadyPromoter( *m_slot, m_cause, m_trace );
222 result = promoter.visit( node );
223 } else {
224 result = true;
225 }
226
227 // return true only when an algorithm is not lower than DR in its FSM
228 // i.e., the visitor has done everything it could with this algorithm
229 return result;
230 }
concurrency::Supervisor::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:72
compareRootHistos.state
state
Definition: compareRootHistos.py:424
EventSlot::algsStates
AlgsExecutionStates algsStates
Vector of algorithms states.
Definition: EventSlot.h:33
concurrency::Supervisor::m_trace
bool m_trace
Definition: PRGraphVisitors.h:74
concurrency::Supervisor::m_cause
Cause m_cause
Definition: PRGraphVisitors.h:73

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 132 of file PRGraphVisitors.cpp.

133 {
134
135 if ( m_slot->controlFlowState[node.getNodeIndex()] != -1 ) return false;
136 return true;
137 }
concurrency::Supervisor::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:72
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:37

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

Reimplemented from concurrency::IGraphVisitor.

Definition at line 200 of file PRGraphVisitors.cpp.

201 {
202
203 if ( m_slot->controlFlowState[node.getNodeIndex()] != -1 ) return false;
204 return true;
205 }
concurrency::Supervisor::m_slot
EventSlot * m_slot
Definition: PRGraphVisitors.h:72
EventSlot::controlFlowState
std::vector< int > controlFlowState
State of the control flow.
Definition: EventSlot.h:37

## Member Data Documentation

Cause concurrency::Supervisor::m_cause

Definition at line 73 of file PRGraphVisitors.h.

EventSlot* concurrency::Supervisor::m_slot

Definition at line 72 of file PRGraphVisitors.h.

bool concurrency::Supervisor::m_trace

Definition at line 74 of file PRGraphVisitors.h.

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

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