2 #include "../../AlgsExecutionStates.h" 28 result = dataNode->accept( *
this );
59 for (
auto algoNode : producers ) {
61 if ( AState::EVTACCEPTED ==
state || AState::EVTREJECTED ==
state ) {
68 for (
auto algoNode : producers ) {
70 if ( AState::EVTACCEPTED ==
state || AState::EVTREJECTED ==
state ) {
96 for (
auto condAlg : node.
getProducers() ) condAlg->accept( promoter );
112 else if ( AState::EVTACCEPTED ==
state )
113 decision = !node.
isLiar();
114 else if ( AState::EVTREJECTED ==
state )
117 if ( -1 != decision ) {
123 for (
auto& consumer :
output->getConsumers() ) consumer->accept( promoter );
128 if ( parents.size() == 1 ) {
129 parents[0]->accept( vis );
132 for (
auto& p : parents ) {
134 if ( scout.reply() ) p->accept( vis );
139 for (
auto& p : parents ) {
141 if ( scout.reply() ) p->accept( vis );
162 bool foundNonResolvedChild =
false;
163 bool foundNegativeChild =
false;
164 bool foundPositiveChild =
false;
177 bool breakout =
false;
178 for (
unsigned int slotIndex : searchResult->second ) {
187 if ( childDecision == -1 )
188 foundNonResolvedChild =
true;
189 else if ( childDecision == 1 )
190 foundPositiveChild =
true;
192 foundNegativeChild =
true;
195 if ( node.
m_modeOR && foundPositiveChild ) {
199 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
205 if ( foundNonResolvedChild ) {
214 if ( breakout )
break;
220 if ( childDecision == -1 )
221 foundNonResolvedChild =
true;
222 else if ( childDecision == 1 )
223 foundPositiveChild =
true;
225 foundNegativeChild =
true;
228 if ( node.
m_modeOR && foundPositiveChild ) {
231 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
236 if ( foundNonResolvedChild )
break;
241 if ( !foundNonResolvedChild && decision == -1 ) {
243 if ( foundPositiveChild )
248 if ( foundNegativeChild )
260 if ( node.
m_allPass && !foundNonResolvedChild ) decision = 1;
262 if ( decision != -1 ) {
272 if ( scout.reply() ) p->accept( *
this );
279 if ( scout.reply() ) p->accept( *
this );
284 if ( oldSlot )
m_slot = oldSlot;
291 for (
unsigned int slotIndex : searchResult->second ) {
297 bool result = child->accept( *
this );
307 bool result = child->accept( *
this );
313 if ( oldSlot )
m_slot = oldSlot;
333 if ( AState::INITIAL ==
state ) states.set( node.
getAlgoIndex(), AState::CONTROLREADY ).ignore();
336 if ( AState::CONTROLREADY ==
state ) {
338 result = promoter.visit( node );
358 bool allChildDecisionsResolved =
true;
362 child->accept( *
this );
365 if ( childDecision == -1 ) allChildDecisionsResolved =
false;
374 for (
auto parent : node.
m_parents ) { parent->accept( *
this ); }
379 if ( allChildDecisionsResolved ) {
383 for (
auto parent : node.
m_parents ) { parent->accept( *
this ); }
386 return allChildDecisionsResolved;
405 states.set( node.
getAlgoIndex(), AState::CONTROLREADY );
406 if ( dataPromoter.visit( node ) ) {
414 }
else if ( AState::CONTROLREADY == states[node.
getAlgoIndex()] && dataPromoter.visit( node ) ) {
std::string entryPoint
Event Views bookkeeping (TODO: optimize view bookkeeping)
Class representing an event slot.
std::vector< DecisionNode * > m_parents
Direct parent nodes.
const std::string & getNodeName() const
Get node name.
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
const DataObjID & getPath()
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.
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.
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.
AlgsExecutionStates algsStates
Vector of algorithms states.
SmartIF< ICondSvc > m_condSvc