| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Private Attributes | List of all members
concurrency::recursive_CF::DecisionNode Class Reference

`#include <src/ControlFlowGraph.h>`

Inheritance diagram for concurrency::recursive_CF::DecisionNode:
[legend]
Collaboration diagram for concurrency::recursive_CF::DecisionNode:
[legend]

## Public Member Functions
| DecisionNode (ControlFlowGraph &graph, unsigned int nodeIndex, const std::string &name, bool modeConcurrent, bool modePromptDecision, bool modeOR, bool allPass)
| Constructor. More...
| ~DecisionNode () override
| Destructor. More...
void | initialize (const std::unordered_map< std::string, unsigned int > &algname_index_map) override
| Initialize. More...
int | updateState (AlgsExecutionStates &states, std::vector< int > &node_decisions) const override
| Method to set algos to CONTROLREADY, if possible. More...
void | addDaughterNode (ControlFlowNode *node)
| Add a daughter node. More...
const std::vector< ControlFlowNode * > & | getDaughters () const
void | printState (std::stringstream &output, AlgsExecutionStates &states, const std::vector< int > &node_decisions, const unsigned int &recursionLevel) const override
| Print a string representing the control flow state. More...
Public Member Functions inherited from concurrency::recursive_CF::ControlFlowNode
| ControlFlowNode (ControlFlowGraph &graph, unsigned int nodeIndex, const std::string &name)
| Constructor. More...
virtual | ~ControlFlowNode ()
| Destructor. More...
const unsigned int & | getNodeIndex () const
| Get node index. More...
const std::string & | getNodeName () const
| Get node name. More...

## Public Attributes
bool | m_modeConcurrent
| Whether all daughters will be evaluated concurrently or sequentially. More...
bool | m_modePromptDecision
| Whether to evaluate the hub decision ASA its child decisions allow to do that. More...
bool | m_modeOR
| Whether acting as "and" (false) or "or" node (true) More...
bool | m_allPass
| Whether always passing regardless of daughter results. More...
Public Attributes inherited from concurrency::recursive_CF::ControlFlowNode
ControlFlowGraph * | m_graph

## Private Attributes
std::vector< ControlFlowNode * > | m_children
| All direct daughter nodes in the tree. More...

## Additional Inherited Members
Protected Member Functions inherited from concurrency::recursive_CF::ControlFlowNode
std::string | stateToString (const int &stateId) const
| Translation between state id and name. More...
Protected Attributes inherited from concurrency::recursive_CF::ControlFlowNode
unsigned int | m_nodeIndex
std::string | m_nodeName

## Detailed Description

Definition at line 57 of file ControlFlowGraph.h.

## Constructor & Destructor Documentation

concurrency::recursive_CF::DecisionNode::DecisionNode | ( | ControlFlowGraph & | graph,
|  | unsigned int | nodeIndex,
|  | const std::string & | name,
|  | bool | modeConcurrent,
|  | bool | modePromptDecision,
|  | bool | modeOR,
|  | bool | allPass
| ) |  |
| inline

Constructor.

Definition at line 61 of file ControlFlowGraph.h.

63 : ControlFlowNode( graph, nodeIndex, name )
64 , m_modeConcurrent( modeConcurrent )
65 , m_modePromptDecision( modePromptDecision )
66 , m_modeOR( modeOR )
67 , m_allPass( allPass )
68 , m_children()
69 {
70 }
concurrency::recursive_CF::DecisionNode::m_children
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
Definition: ControlFlowGraph.h:98
concurrency::recursive_CF::DecisionNode::m_modePromptDecision
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
Definition: ControlFlowGraph.h:90
concurrency::recursive_CF::DecisionNode::m_allPass
bool m_allPass
Whether always passing regardless of daughter results.
Definition: ControlFlowGraph.h:94
concurrency::recursive_CF::ControlFlowNode::ControlFlowNode
ControlFlowNode(ControlFlowGraph &graph, unsigned int nodeIndex, const std::string &name)
Constructor.
Definition: ControlFlowGraph.h:29
plotSpeedupsPyRoot.graph
graph
Definition: plotSpeedupsPyRoot.py:142
concurrency::recursive_CF::DecisionNode::m_modeOR
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
Definition: ControlFlowGraph.h:92
concurrency::recursive_CF::DecisionNode::m_modeConcurrent
bool m_modeConcurrent
Whether all daughters will be evaluated concurrently or sequentially.
Definition: ControlFlowGraph.h:87

concurrency::recursive_CF::DecisionNode::~DecisionNode | ( |  | ) |
| override

Destructor.

Definition at line 23 of file ControlFlowGraph.cpp.

24 {
25
26 for ( auto node : m_children ) delete node;
27 }
concurrency::recursive_CF::DecisionNode::m_children
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
Definition: ControlFlowGraph.h:98

## Member Function Documentation

void concurrency::recursive_CF::DecisionNode::addDaughterNode | ( | ControlFlowNode * | node | ) |

Add a daughter node.

Definition at line 37 of file ControlFlowGraph.cpp.

38 {
39
40 if ( std::find( m_children.begin(), m_children.end(), node ) == m_children.end() ) m_children.push_back( node );
41 }
concurrency::recursive_CF::DecisionNode::m_children
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
Definition: ControlFlowGraph.h:98
std::find
T find(T...args)

const std::vector<ControlFlowNode*>& concurrency::recursive_CF::DecisionNode::getDaughters | ( |  | ) | const
| inline

Definition at line 80 of file ControlFlowGraph.h.

80 { return m_children; }
concurrency::recursive_CF::DecisionNode::m_children
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
Definition: ControlFlowGraph.h:98

void concurrency::recursive_CF::DecisionNode::initialize | ( | const std::unordered_map< std::string, unsigned int > & | algname_index_map | ) |
| override virtual

Initialize.

Implements concurrency::recursive_CF::ControlFlowNode.

Definition at line 30 of file ControlFlowGraph.cpp.

31 {
32
33 for ( auto daughter : m_children ) daughter->initialize( algname_index_map );
34 }
concurrency::recursive_CF::DecisionNode::m_children
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
Definition: ControlFlowGraph.h:98

void concurrency::recursive_CF::DecisionNode::printState | ( | std::stringstream & | output,
|  | AlgsExecutionStates & | states,
|  | const std::vector< int > & | node_decisions,
|  | const unsigned int & | recursionLevel
| ) |  | const
| override virtual

Print a string representing the control flow state.

Implements concurrency::recursive_CF::ControlFlowNode.

Definition at line 44 of file ControlFlowGraph.cpp.

46 {
47
48 output << std::string( recursionLevel, ' ' ) << m_nodeName << " (" << m_nodeIndex << ")"
49 << ", w/ decision: " << stateToString( node_decisions[m_nodeIndex] ) << "(" << node_decisions[m_nodeIndex]
50 << ")" << std::endl;
51 for ( auto daughter : m_children ) {
52 daughter->printState( output, states, node_decisions, recursionLevel + 2 );
53 }
54 }
concurrency::recursive_CF::DecisionNode::m_children
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
Definition: ControlFlowGraph.h:98
concurrency::recursive_CF::ControlFlowNode::stateToString
std::string stateToString(const int &stateId) const
Translation between state id and name.
Definition: ControlFlowGraph.cpp:11
std::endl
T endl(T...args)
std::string
STL class.
concurrency::recursive_CF::ControlFlowNode::m_nodeName
std::string m_nodeName
Definition: ControlFlowGraph.h:54
concurrency::recursive_CF::ControlFlowNode::m_nodeIndex
unsigned int m_nodeIndex
Definition: ControlFlowGraph.h:53

int concurrency::recursive_CF::DecisionNode::updateState | ( | AlgsExecutionStates & | states,
|  | std::vector< int > & | node_decisions
| ) |  | const
| override virtual

Method to set algos to CONTROLREADY, if possible.

Implements concurrency::recursive_CF::ControlFlowNode.

Definition at line 57 of file ControlFlowGraph.cpp.

58 {
59 // check whether we already had a result earlier
60 // if (-1 != node_decisions[m_nodeIndex] ) { return node_decisions[m_nodeIndex]; }
61 int decision = ( ( m_allPass && m_modePromptDecision ) ? 1 : -1 );
62 bool hasUndecidedChild = false;
63 for ( auto daughter : m_children ) {
64 if ( m_modePromptDecision && ( -1 != decision || hasUndecidedChild ) ) {
65 node_decisions[m_nodeIndex] = decision;
66 return decision;
67 } // if prompt decision, return once result is known already or we can't
68 // fully evaluate right now because one daugther decision is missing still
69 auto res = daughter->updateState( states, node_decisions );
70 if ( -1 == res ) {
71 hasUndecidedChild = true;
72 } else if ( false == m_modeOR && res == 0 ) {
73 decision = 0;
74 } // "and"-mode (once first result false, the overall decision is false)
75 else if ( true == m_modeOR && res == 1 ) {
76 decision = 1;
77 } // "or"-mode (once first result true, the overall decision is true)
78 }
79 // what to do with yet undefined answers depends on whether AND or OR mode applies
80 if ( !hasUndecidedChild && -1 == decision ) {
81 // OR mode: all results known, and none true -> reject
82 if ( true == m_modeOR ) {
83 decision = 0;
84 }
85 // AND mode: all results known, and no false -> accept
86 else {
87 decision = 1;
88 }
89 }
90 // in all other cases I stay with previous decisions
91 node_decisions[m_nodeIndex] = decision;
92 if ( m_allPass ) decision = 1;
93 return decision;
94 }
concurrency::recursive_CF::DecisionNode::m_children
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
Definition: ControlFlowGraph.h:98
concurrency::recursive_CF::DecisionNode::m_modePromptDecision
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
Definition: ControlFlowGraph.h:90
concurrency::recursive_CF::DecisionNode::m_allPass
bool m_allPass
Whether always passing regardless of daughter results.
Definition: ControlFlowGraph.h:94
concurrency::recursive_CF::DecisionNode::m_modeOR
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
Definition: ControlFlowGraph.h:92
concurrency::recursive_CF::ControlFlowNode::m_nodeIndex
unsigned int m_nodeIndex
Definition: ControlFlowGraph.h:53

## Member Data Documentation

bool concurrency::recursive_CF::DecisionNode::m_allPass

Whether always passing regardless of daughter results.

Definition at line 94 of file ControlFlowGraph.h.

std::vector<ControlFlowNode*> concurrency::recursive_CF::DecisionNode::m_children
| private

All direct daughter nodes in the tree.

Definition at line 98 of file ControlFlowGraph.h.

bool concurrency::recursive_CF::DecisionNode::m_modeConcurrent

Whether all daughters will be evaluated concurrently or sequentially.

Definition at line 87 of file ControlFlowGraph.h.

bool concurrency::recursive_CF::DecisionNode::m_modeOR

Whether acting as "and" (false) or "or" node (true)

Definition at line 92 of file ControlFlowGraph.h.

bool concurrency::recursive_CF::DecisionNode::m_modePromptDecision

Whether to evaluate the hub decision ASA its child decisions allow to do that.

Applicable to both concurrent and sequential cases.

Definition at line 90 of file ControlFlowGraph.h.

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

- GaudiHive/src/ControlFlowGraph.h
- GaudiHive/src/ControlFlowGraph.cpp