12 #include "../../AlgsExecutionStates.h" 38 result = dataNode->accept( *
this );
69 for (
auto algoNode : producers ) {
71 if ( AState::EVTACCEPTED ==
state || AState::EVTREJECTED ==
state ) {
78 for (
auto algoNode : producers ) {
80 if ( AState::EVTACCEPTED ==
state || AState::EVTREJECTED ==
state ) {
106 for (
auto condAlg : node.
getProducers() ) condAlg->accept( promoter );
122 else if ( AState::EVTACCEPTED ==
state )
123 decision = !node.
isLiar();
124 else if ( AState::EVTREJECTED ==
state )
127 if ( -1 != decision ) {
133 for (
auto& consumer :
output->getConsumers() ) consumer->accept( promoter );
138 if ( parents.size() == 1 ) {
139 parents[0]->accept( vis );
142 for (
auto& p : parents ) {
144 if ( scout.reply() ) p->accept( vis );
149 for (
auto& p : parents ) {
151 if ( scout.reply() ) p->accept( vis );
172 bool foundNonResolvedChild =
false;
173 bool foundNegativeChild =
false;
174 bool foundPositiveChild =
false;
187 bool breakout =
false;
188 for (
unsigned int slotIndex : searchResult->second ) {
197 if ( childDecision == -1 )
198 foundNonResolvedChild =
true;
199 else if ( childDecision == 1 )
200 foundPositiveChild =
true;
202 foundNegativeChild =
true;
205 if ( node.
m_modeOR && foundPositiveChild ) {
209 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
215 if ( foundNonResolvedChild ) {
224 if ( breakout )
break;
230 if ( childDecision == -1 )
231 foundNonResolvedChild =
true;
232 else if ( childDecision == 1 )
233 foundPositiveChild =
true;
235 foundNegativeChild =
true;
238 if ( node.
m_modeOR && foundPositiveChild ) {
241 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
246 if ( foundNonResolvedChild )
break;
251 if ( !foundNonResolvedChild && decision == -1 ) {
253 if ( foundPositiveChild )
258 if ( foundNegativeChild )
270 if ( node.
m_allPass && !foundNonResolvedChild ) decision = 1;
272 if ( decision != -1 ) {
282 if ( scout.reply() ) p->accept( *
this );
289 if ( scout.reply() ) p->accept( *
this );
294 if ( oldSlot )
m_slot = oldSlot;
301 for (
unsigned int slotIndex : searchResult->second ) {
307 bool result = child->accept( *
this );
317 bool result = child->accept( *
this );
323 if ( oldSlot )
m_slot = oldSlot;
343 if ( AState::INITIAL ==
state ) states.set( node.
getAlgoIndex(), AState::CONTROLREADY ).ignore();
346 if ( AState::CONTROLREADY ==
state ) {
348 result = promoter.visit( node );
368 bool allChildDecisionsResolved =
true;
372 child->accept( *
this );
375 if ( childDecision == -1 ) allChildDecisionsResolved =
false;
389 if ( allChildDecisionsResolved ) {
396 return allChildDecisionsResolved;
415 states.set( node.
getAlgoIndex(), AState::CONTROLREADY ).ignore( );
416 if ( dataPromoter.visit( node ) ) {
417 states.set( node.
getAlgoIndex(), AState::SCHEDULED ).ignore( );
418 states.set( node.
getAlgoIndex(), AState::EVTACCEPTED ).ignore( );
424 }
else if ( AState::CONTROLREADY == states[node.
getAlgoIndex()] && dataPromoter.visit( node ) ) {
425 states.set( node.
getAlgoIndex(), AState::SCHEDULED ).ignore( );
426 states.set( node.
getAlgoIndex(), AState::EVTACCEPTED ).ignore( );
std::string entryPoint
Event Views bookkeeping (TODO: optimize view bookkeeping)
Class representing an event slot.
std::vector< DecisionNode * > m_parents
Direct parent nodes.
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
const std::vector< DecisionNode * > & getParentDecisionHubs() const
Get all parent decision hubs.
std::vector< int > controlFlowState
State of the control flow.
std::vector< EventSlot > allSubSlots
Actual sub-slot instances.
bool m_allPass
Whether always passing regardless of daughter results.
bool visit(DecisionNode &) override
bool isOptimist() const
Check if positive control flow decision is enforced.
bool visit(AlgorithmNode &) override
const unsigned int & getAlgoIndex() const
Get algorithm index.
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
const std::vector< AlgorithmNode * > & getProducers() const
Get all data object producers.
PrecedenceRulesGraph * m_graph
virtual bool isValidID(const EventContext &ctx, const DataObjID &id) const =0
check to see if a specific condition object ID is valid for this event
StatusCode set(unsigned int iAlgo, State newState)
State
Execution states of the algorithms.
const std::vector< ControlFlowNode * > & getDaughters() const
Get children nodes.
const DataObjID & name() const
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
void addEdgeToPrecTrace(const AlgorithmNode *u, const AlgorithmNode *v)
set cause-effect connection between two algorithms in the precedence trace
bool visitEnter(DecisionNode &) const override
bool visit(DecisionNode &) override
bool m_modeConcurrent
Whether all daughters will be evaluated concurrently or sequentially.
const std::vector< DataNode * > & getInputDataNodes() const
Get all consumer nodes.
bool visitEnter(DecisionNode &) const override
const std::vector< DataNode * > & getOutputDataNodes() const
Get all supplier nodes.
const Gaudi::Algorithm & parent
EventSlot * parentSlot
Pointer to parent slot (null for top level)
bool m_inverted
Whether the selection result is negated or not.
bool isLiar() const
Check if control flow logic is always inverted.
const unsigned int & getNodeIndex() const
Get node index.
std::unordered_map< std::string, std::vector< unsigned int > > subSlotsByNode
Listing of sub-slots by the node (name) they are attached to.
std::unique_ptr< EventContext > eventContext
Cache for the eventContext.
const std::string & name() const
Get node name.
AlgsExecutionStates algsStates
Vector of algorithms states.
SmartIF< ICondSvc > m_condSvc