The Gaudi Framework  v30r3 (a5ef0a68)
concurrency::DecisionNode Class Referencefinal

#include <src/PrecedenceRulesGraph.h>

Inheritance diagram for concurrency::DecisionNode:
Collaboration diagram for concurrency::DecisionNode:

Public Member Functions

 DecisionNode (PrecedenceRulesGraph &graph, unsigned int nodeIndex, const std::string &name, Concurrent modeConcurrent, PromptDecision modePromptDecision, ModeOr modeOR, AllPass allPass, Inverted isInverted)
 Constructor. More...
 
bool accept (IGraphVisitor &visitor) override
 Visitor entry point. More...
 
void addParentNode (DecisionNode *node)
 Add a parent node. More...
 
void addDaughterNode (ControlFlowNode *node)
 Add a daughter node. More...
 
const std::vector< ControlFlowNode * > & getDaughters () const
 Get children nodes. More...
 
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::ControlFlowNode
 ControlFlowNode (PrecedenceRulesGraph &graph, unsigned int nodeIndex, const std::string &name)
 Constructor. More...
 
virtual ~ControlFlowNode ()=default
 Destructor. More...
 
const unsigned int & getNodeIndex () const
 Get node index. More...
 
const std::stringgetNodeName () 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...
 
bool m_inverted {false}
 Whether the selection result is negated or not. More...
 
std::vector< ControlFlowNode * > m_children
 All direct daughter nodes in the tree. More...
 
std::vector< DecisionNode * > m_parents
 Direct parent nodes. More...
 
- Public Attributes inherited from concurrency::ControlFlowNode
PrecedenceRulesGraphm_graph
 

Additional Inherited Members

- Protected Attributes inherited from concurrency::ControlFlowNode
unsigned int m_nodeIndex
 
std::string m_nodeName
 

Detailed Description

Definition at line 457 of file PrecedenceRulesGraph.h.

Constructor & Destructor Documentation

concurrency::DecisionNode::DecisionNode ( PrecedenceRulesGraph graph,
unsigned int  nodeIndex,
const std::string name,
Concurrent  modeConcurrent,
PromptDecision  modePromptDecision,
ModeOr  modeOR,
AllPass  allPass,
Inverted  isInverted 
)
inline

Constructor.

Definition at line 461 of file PrecedenceRulesGraph.h.

464  : ControlFlowNode( graph, nodeIndex, name )
465  , m_modeConcurrent( modeConcurrent )
466  , m_modePromptDecision( modePromptDecision )
467  , m_modeOR( modeOR )
468  , m_allPass( allPass )
469  , m_inverted( isInverted )
470  {
471  }
ControlFlowNode(PrecedenceRulesGraph &graph, unsigned int nodeIndex, const std::string &name)
Constructor.
bool m_allPass
Whether always passing regardless of daughter results.
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
bool m_modeConcurrent
Whether all daughters will be evaluated concurrently or sequentially.
bool m_inverted
Whether the selection result is negated or not.

Member Function Documentation

bool concurrency::DecisionNode::accept ( IGraphVisitor visitor)
overridevirtual

Visitor entry point.

Implements concurrency::ControlFlowNode.

Definition at line 59 of file PrecedenceRulesGraph.cpp.

60  {
61 
62  if ( visitor.visitEnter( *this ) ) {
63  // try to aggregate a decision
64  bool result = visitor.visit( *this );
65  return !result;
66  }
67 
68  return false; // visitor was rejected (since the decision node has an aggregated decision already)
69  }
void concurrency::DecisionNode::addDaughterNode ( ControlFlowNode node)

Add a daughter node.

Definition at line 40 of file PrecedenceRulesGraph.cpp.

41  {
42 
43  if ( std::find( m_children.begin(), m_children.end(), node ) == m_children.end() ) m_children.push_back( node );
44  }
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
T find(T...args)
void concurrency::DecisionNode::addParentNode ( DecisionNode node)

Add a parent node.

Definition at line 33 of file PrecedenceRulesGraph.cpp.

34  {
35 
36  if ( std::find( m_parents.begin(), m_parents.end(), node ) == m_parents.end() ) m_parents.push_back( node );
37  }
std::vector< DecisionNode * > m_parents
Direct parent nodes.
T find(T...args)
const std::vector<ControlFlowNode*>& concurrency::DecisionNode::getDaughters ( ) const
inline

Get children nodes.

Definition at line 480 of file PrecedenceRulesGraph.h.

480 { return m_children; }
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
void concurrency::DecisionNode::printState ( std::stringstream output,
AlgsExecutionStates states,
const std::vector< int > &  node_decisions,
const unsigned int &  recursionLevel 
) const
overridevirtual

Print a string representing the control flow state.

Implements concurrency::ControlFlowNode.

Definition at line 47 of file PrecedenceRulesGraph.cpp.

49  {
50 
51  output << std::string( recursionLevel, ' ' ) << m_nodeName << " (" << m_nodeIndex << ")"
52  << ", w/ decision: " << stateToString( node_decisions[m_nodeIndex] ) << "(" << node_decisions[m_nodeIndex]
53  << ")" << std::endl;
54 
55  for ( auto daughter : m_children ) daughter->printState( output, states, node_decisions, recursionLevel + 2 );
56  }
std::vector< ControlFlowNode * > m_children
All direct daughter nodes in the tree.
T endl(T...args)
STL class.

Member Data Documentation

bool concurrency::DecisionNode::m_allPass

Whether always passing regardless of daughter results.

Definition at line 494 of file PrecedenceRulesGraph.h.

std::vector<ControlFlowNode*> concurrency::DecisionNode::m_children

All direct daughter nodes in the tree.

Definition at line 498 of file PrecedenceRulesGraph.h.

bool concurrency::DecisionNode::m_inverted {false}

Whether the selection result is negated or not.

Definition at line 496 of file PrecedenceRulesGraph.h.

bool concurrency::DecisionNode::m_modeConcurrent

Whether all daughters will be evaluated concurrently or sequentially.

Definition at line 487 of file PrecedenceRulesGraph.h.

bool concurrency::DecisionNode::m_modeOR

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

Definition at line 492 of file PrecedenceRulesGraph.h.

bool concurrency::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 490 of file PrecedenceRulesGraph.h.

std::vector<DecisionNode*> concurrency::DecisionNode::m_parents

Direct parent nodes.

Definition at line 500 of file PrecedenceRulesGraph.h.


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