The Gaudi Framework  v29r0 (ff2e7097)
concurrency::AlgorithmNode Class Reference

#include <src/PrecedenceRulesGraph.h>

Inheritance diagram for concurrency::AlgorithmNode:
Collaboration diagram for concurrency::AlgorithmNode:

Public Member Functions

 AlgorithmNode (PrecedenceRulesGraph &graph, Algorithm *algoPtr, unsigned int nodeIndex, unsigned int algoIndex, bool inverted, bool allPass)
 Constructor. More...
 
 ~AlgorithmNode ()
 Destructor. More...
 
bool accept (IGraphVisitor &visitor) override
 Visitor entry point. More...
 
void addParentNode (DecisionNode *node)
 Add a parent node. More...
 
const std::vector< DecisionNode * > & getParentDecisionHubs () const
 Get all parent decision hubs. More...
 
void addOutputDataNode (DataNode *node)
 Associate an AlgorithmNode, which is a data supplier for this one. More...
 
void addInputDataNode (DataNode *node)
 Associate an AlgorithmNode, which is a data consumer of this one. More...
 
const std::vector< DataNode * > & getOutputDataNodes () const
 Get all supplier nodes. More...
 
const std::vector< DataNode * > & getInputDataNodes () const
 Get all consumer nodes. More...
 
void setRank (float &rank)
 Set Algorithm rank. More...
 
const float & getRank () const
 Get Algorithm rank. More...
 
AlgorithmgetAlgorithm () const
 get Algorithm representatives More...
 
const unsigned int & getAlgoIndex () const
 Get algorithm index. More...
 
void setIOBound (bool value)
 Set the I/O-boundness flag. More...
 
bool isIOBound () const
 Check if algorithm is I/O-bound. More...
 
bool isOptimist () const
 Check if positive control flow decision is enforced. More...
 
bool isLiar () const
 Check if control flow logic is always inverted. 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 ()
 Destructor. More...
 
const unsigned int & getNodeIndex () const
 Get node index. More...
 
const std::stringgetNodeName () const
 Get node name. More...
 

Public Attributes

std::vector< DecisionNode * > m_parents
 Control flow parents of an AlgorithmNode (DecisionNodes) More...
 
- Public Attributes inherited from concurrency::ControlFlowNode
PrecedenceRulesGraphm_graph
 

Private Attributes

Algorithmm_algorithm
 Algorithm representative behind the AlgorithmNode. More...
 
unsigned int m_algoIndex
 The index of the algorithm. More...
 
std::string m_algoName
 The name of the algorithm. More...
 
bool m_inverted
 Whether the selection result is negated or not. More...
 
bool m_allPass
 Whether the selection result is relevant or always "pass". More...
 
float m_rank
 Algorithm rank of any kind. More...
 
bool m_isIOBound
 If an algorithm is blocking. More...
 
std::vector< DataNode * > m_outputs
 Algorithm outputs (DataNodes) More...
 
std::vector< DataNode * > m_inputs
 Algorithm inputs (DataNodes) More...
 

Additional Inherited Members

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

Detailed Description

Definition at line 413 of file PrecedenceRulesGraph.h.

Constructor & Destructor Documentation

concurrency::AlgorithmNode::AlgorithmNode ( PrecedenceRulesGraph graph,
Algorithm algoPtr,
unsigned int  nodeIndex,
unsigned int  algoIndex,
bool  inverted,
bool  allPass 
)
inline

Constructor.

Definition at line 417 of file PrecedenceRulesGraph.h.

419  : ControlFlowNode( graph, nodeIndex, algoPtr->name() )
420  , m_algorithm( algoPtr )
421  , m_algoIndex( algoIndex )
422  , m_algoName( algoPtr->name() )
423  , m_inverted( inverted )
424  , m_allPass( allPass )
425  , m_rank( -1 )
426  , m_isIOBound( algoPtr->isIOBound() ){};
ControlFlowNode(PrecedenceRulesGraph &graph, unsigned int nodeIndex, const std::string &name)
Constructor.
unsigned int m_algoIndex
The index of the algorithm.
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:731
std::string m_algoName
The name of the algorithm.
bool m_inverted
Whether the selection result is negated or not.
Algorithm * m_algorithm
Algorithm representative behind the AlgorithmNode.
float m_rank
Algorithm rank of any kind.
bool isIOBound() const
Definition: Algorithm.h:472
bool m_isIOBound
If an algorithm is blocking.
bool m_allPass
Whether the selection result is relevant or always "pass".
concurrency::AlgorithmNode::~AlgorithmNode ( )

Destructor.

Definition at line 90 of file PrecedenceRulesGraph.cpp.

91  {
92 
93  for ( auto node : m_outputs ) {
94  delete node;
95  }
96  }
std::vector< DataNode * > m_outputs
Algorithm outputs (DataNodes)

Member Function Documentation

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

Visitor entry point.

Implements concurrency::ControlFlowNode.

Definition at line 109 of file PrecedenceRulesGraph.cpp.

110  {
111 
112  if ( visitor.visitEnter( *this ) ) {
113  visitor.visit( *this );
114  return true; // visitor was accepted to promote the algorithm
115  }
116 
117  return false; // visitor was rejected (since the algorithm already produced a decision)
118  }
void concurrency::AlgorithmNode::addInputDataNode ( DataNode node)

Associate an AlgorithmNode, which is a data consumer of this one.

Definition at line 135 of file PrecedenceRulesGraph.cpp.

136  {
137 
138  if ( std::find( m_inputs.begin(), m_inputs.end(), node ) == m_inputs.end() ) m_inputs.push_back( node );
139  }
T find(T...args)
std::vector< DataNode * > m_inputs
Algorithm inputs (DataNodes)
void concurrency::AlgorithmNode::addOutputDataNode ( DataNode node)

Associate an AlgorithmNode, which is a data supplier for this one.

Definition at line 128 of file PrecedenceRulesGraph.cpp.

129  {
130 
131  if ( std::find( m_outputs.begin(), m_outputs.end(), node ) == m_outputs.end() ) m_outputs.push_back( node );
132  }
std::vector< DataNode * > m_outputs
Algorithm outputs (DataNodes)
T find(T...args)
void concurrency::AlgorithmNode::addParentNode ( DecisionNode node)

Add a parent node.

Definition at line 121 of file PrecedenceRulesGraph.cpp.

122  {
123 
124  if ( std::find( m_parents.begin(), m_parents.end(), node ) == m_parents.end() ) m_parents.push_back( node );
125  }
std::vector< DecisionNode * > m_parents
Control flow parents of an AlgorithmNode (DecisionNodes)
T find(T...args)
const unsigned int& concurrency::AlgorithmNode::getAlgoIndex ( ) const
inline

Get algorithm index.

Definition at line 455 of file PrecedenceRulesGraph.h.

455 { return m_algoIndex; }
unsigned int m_algoIndex
The index of the algorithm.
Algorithm* concurrency::AlgorithmNode::getAlgorithm ( ) const
inline

get Algorithm representatives

Definition at line 453 of file PrecedenceRulesGraph.h.

453 { return m_algorithm; }
Algorithm * m_algorithm
Algorithm representative behind the AlgorithmNode.
const std::vector<DataNode*>& concurrency::AlgorithmNode::getInputDataNodes ( ) const
inline

Get all consumer nodes.

Definition at line 445 of file PrecedenceRulesGraph.h.

445 { return m_inputs; }
std::vector< DataNode * > m_inputs
Algorithm inputs (DataNodes)
const std::vector<DataNode*>& concurrency::AlgorithmNode::getOutputDataNodes ( ) const
inline

Get all supplier nodes.

Definition at line 443 of file PrecedenceRulesGraph.h.

443 { return m_outputs; }
std::vector< DataNode * > m_outputs
Algorithm outputs (DataNodes)
const std::vector<DecisionNode*>& concurrency::AlgorithmNode::getParentDecisionHubs ( ) const
inline

Get all parent decision hubs.

Definition at line 436 of file PrecedenceRulesGraph.h.

436 { return m_parents; }
std::vector< DecisionNode * > m_parents
Control flow parents of an AlgorithmNode (DecisionNodes)
const float& concurrency::AlgorithmNode::getRank ( ) const
inline

Get Algorithm rank.

Definition at line 450 of file PrecedenceRulesGraph.h.

450 { return m_rank; }
float m_rank
Algorithm rank of any kind.
bool concurrency::AlgorithmNode::isIOBound ( ) const
inline

Check if algorithm is I/O-bound.

Definition at line 460 of file PrecedenceRulesGraph.h.

460 { return m_isIOBound; }
bool m_isIOBound
If an algorithm is blocking.
bool concurrency::AlgorithmNode::isLiar ( ) const
inline

Check if control flow logic is always inverted.

Definition at line 465 of file PrecedenceRulesGraph.h.

465 { return m_inverted; };
bool m_inverted
Whether the selection result is negated or not.
bool concurrency::AlgorithmNode::isOptimist ( ) const
inline

Check if positive control flow decision is enforced.

Definition at line 463 of file PrecedenceRulesGraph.h.

463 { return m_allPass; };
bool m_allPass
Whether the selection result is relevant or always "pass".
void concurrency::AlgorithmNode::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 99 of file PrecedenceRulesGraph.cpp.

101  {
102  output << std::string( recursionLevel, ' ' ) << m_nodeName << " (" << m_nodeIndex << ")"
103  << ", w/ decision: " << stateToString( node_decisions[m_nodeIndex] ) << "(" << node_decisions[m_nodeIndex]
104  << ")"
105  << ", in state: " << AlgsExecutionStates::stateNames[states[m_algoIndex]] << std::endl;
106  }
unsigned int m_algoIndex
The index of the algorithm.
T endl(T...args)
std::string stateToString(const int &stateId) const
Translation between state id and name.
STL class.
static std::map< State, std::string > stateNames
void concurrency::AlgorithmNode::setIOBound ( bool  value)
inline

Set the I/O-boundness flag.

Definition at line 458 of file PrecedenceRulesGraph.h.

458 { m_isIOBound = value; }
bool m_isIOBound
If an algorithm is blocking.
void concurrency::AlgorithmNode::setRank ( float &  rank)
inline

Set Algorithm rank.

Definition at line 448 of file PrecedenceRulesGraph.h.

448 { m_rank = rank; }
float m_rank
Algorithm rank of any kind.

Member Data Documentation

unsigned int concurrency::AlgorithmNode::m_algoIndex
private

The index of the algorithm.

Definition at line 479 of file PrecedenceRulesGraph.h.

std::string concurrency::AlgorithmNode::m_algoName
private

The name of the algorithm.

Definition at line 481 of file PrecedenceRulesGraph.h.

Algorithm* concurrency::AlgorithmNode::m_algorithm
private

Algorithm representative behind the AlgorithmNode.

Definition at line 477 of file PrecedenceRulesGraph.h.

bool concurrency::AlgorithmNode::m_allPass
private

Whether the selection result is relevant or always "pass".

Definition at line 485 of file PrecedenceRulesGraph.h.

std::vector<DataNode*> concurrency::AlgorithmNode::m_inputs
private

Algorithm inputs (DataNodes)

Definition at line 494 of file PrecedenceRulesGraph.h.

bool concurrency::AlgorithmNode::m_inverted
private

Whether the selection result is negated or not.

Definition at line 483 of file PrecedenceRulesGraph.h.

bool concurrency::AlgorithmNode::m_isIOBound
private

If an algorithm is blocking.

Definition at line 489 of file PrecedenceRulesGraph.h.

std::vector<DataNode*> concurrency::AlgorithmNode::m_outputs
private

Algorithm outputs (DataNodes)

Definition at line 492 of file PrecedenceRulesGraph.h.

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

Control flow parents of an AlgorithmNode (DecisionNodes)

Definition at line 473 of file PrecedenceRulesGraph.h.

float concurrency::AlgorithmNode::m_rank
private

Algorithm rank of any kind.

Definition at line 487 of file PrecedenceRulesGraph.h.


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