| The Gaudi Framework v29r1 (5cd95fa2)

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

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

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

`#include <src/ControlFlowGraph.h>`

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

## Public Member Functions
| ControlFlowGraph (const std::string &name, SmartIF< ISvcLocator > svc)
| Constructor. More...
| ~ControlFlowGraph () override
| Destructor. More...
void | initialize (const std::unordered_map< std::string, unsigned int > &algname_index_map)
| Initialize graph. More...
void | addHeadNode (const std::string &headName, bool modeConcurrent, bool modePromptDecision, bool modeOR, bool allPass)
| Add a node, which has no parents. More...
DecisionNode * | getHeadNode () const
| Get head node. More...
StatusCode | addAlgorithmNode (Algorithm *daughterAlgo, const std::string &parentName, bool inverted, bool allPass)
| Add algorithm node. More...
StatusCode | addDecisionHubNode (Algorithm *daughterAlgo, const std::string &parentName, bool modeConcurrent, bool modePromptDecision, bool modeOR, bool allPass)
| Add a node, which aggregates decisions of direct daughter nodes. More...
unsigned int | getControlFlowNodeCounter () const
| Get total number of graph nodes. More...
void | updateEventState (AlgsExecutionStates &states, std::vector< int > &node_decisions) const
| Start revision of states and decisions. More...
void | printState (std::stringstream &output, AlgsExecutionStates &states, const std::vector< int > &node_decisions, const unsigned int &recursionLevel) const
| Print a string representing the control flow state. More...
const std::string & | name () const override
| Retrieve name of the service. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
std::string | dumpControlFlow () const
| Print out control flow of Algorithms and Sequences. More...
void | dumpControlFlow (std::ostringstream &, ControlFlowNode *, const int &) const
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
const SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the cached level (originally extracted from the embedded MsgStream) More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...

## Private Attributes
DecisionNode * | m_headNode {nullptr}
| the head node of the control flow graph; may want to have multiple ones once supporting trigger paths More...
AlgoNodesMap | m_algoNameToAlgoNodeMap
| Index: map of algorithm's name to AlgorithmNode. More...
DecisionHubsMap | m_decisionNameToDecisionHubMap
| Index: map of decision's name to DecisionHub. More...
unsigned int | m_nodeCounter {0}
| Total number of nodes in the graph. More...
unsigned int | m_algoCounter {0}
| Total number of algorithm nodes in the graph. More...
SmartIF< ISvcLocator > | m_svcLocator
| Service locator (needed to access the MessageSvc) More...
const std::string | m_name

## Additional Inherited Members
Public Types inherited from CommonMessaging< IControlFlowGraph >
using | base_class = CommonMessaging
Protected Member Functions inherited from CommonMessaging< IControlFlowGraph >
MSG::Level | setUpMessaging ()
| Set up local caches. More...
MSG::Level | resetMessaging ()
| Reinitialize internal states. More...
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Detailed Description

Definition at line 144 of file ControlFlowGraph.h.

## Constructor & Destructor Documentation

concurrency::recursive_CF::ControlFlowGraph::ControlFlowGraph | ( | const std::string & | name,
|  | SmartIF< ISvcLocator > | svc
| ) |  |
| inline

Constructor.

Definition at line 148 of file ControlFlowGraph.h.

148 : m_svcLocator( svc ), m_name( name )
149 {
150 setUpMessaging();
151 }
concurrency::recursive_CF::ControlFlowGraph::m_name
const std::string m_name
Definition: ControlFlowGraph.h:203
CommonMessaging< IControlFlowGraph >::setUpMessaging
MSG::Level setUpMessaging()
Set up local caches.
Definition: CommonMessaging.h:166
concurrency::recursive_CF::ControlFlowGraph::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Service locator (needed to access the MessageSvc)
Definition: ControlFlowGraph.h:202

concurrency::recursive_CF::ControlFlowGraph::~ControlFlowGraph | ( |  | ) |
| inline override

Destructor.

Definition at line 153 of file ControlFlowGraph.h.

154 {
155 if ( m_headNode != 0 ) delete m_headNode;
156 }
concurrency::recursive_CF::ControlFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ControlFlowGraph.h:192

## Member Function Documentation

StatusCode concurrency::recursive_CF::ControlFlowGraph::addAlgorithmNode | ( | Algorithm * | daughterAlgo,
|  | const std::string & | parentName,
|  | bool | inverted,
|  | bool | allPass
| ) |  |

Add algorithm node.

Definition at line 146 of file ControlFlowGraph.cpp.

148 {
149
150 StatusCode sc = StatusCode::SUCCESS;
151
152 auto& algoName = algo->name();
153
154 auto itP = m_decisionNameToDecisionHubMap.find( parentName );
155 concurrency::recursive_CF::DecisionNode* parentNode;
156 if ( itP != m_decisionNameToDecisionHubMap.end() ) {
157 parentNode = itP->second;
158 auto itA = m_algoNameToAlgoNodeMap.find( algoName );
159 concurrency::recursive_CF::AlgorithmNode* algoNode;
160 if ( itA != m_algoNameToAlgoNodeMap.end() ) {
161 algoNode = itA->second;
162 } else {
163 algoNode = new concurrency::recursive_CF::AlgorithmNode( *this, algo, m_nodeCounter, m_algoCounter, inverted,
164 allPass );
165 ++m_nodeCounter;
166 ++m_algoCounter;
167 m_algoNameToAlgoNodeMap[algoName] = algoNode;
168 if ( msgLevel( MSG::VERBOSE ) ) verbose() << "AlgoNode " << algoName << " added @ " << algoNode << endmsg;
169 }
170
171 parentNode->addDaughterNode( algoNode );
172 } else {
173 sc = StatusCode::FAILURE;
174 error() << "Decision hub node " << parentName << ", requested to be parent, is not registered." << endmsg;
175 }
176
177 return sc;
178 }
concurrency::recursive_CF::DecisionNode::addDaughterNode
void addDaughterNode(ControlFlowNode *node)
Add a daughter node.
Definition: ControlFlowGraph.cpp:37
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:118
concurrency::recursive_CF::DecisionNode
Definition: ControlFlowGraph.h:57
std::unordered_map::end
T end(T...args)
MSG::VERBOSE
Definition: IMessageSvc.h:16
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:106
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
concurrency::recursive_CF::AlgorithmNode
Definition: ControlFlowGraph.h:101
std::unordered_map::find
T find(T...args)
concurrency::recursive_CF::ControlFlowGraph::m_algoCounter
unsigned int m_algoCounter
Total number of algorithm nodes in the graph.
Definition: ControlFlowGraph.h:200
concurrency::recursive_CF::ControlFlowGraph::m_algoNameToAlgoNodeMap
AlgoNodesMap m_algoNameToAlgoNodeMap
Index: map of algorithm&#39;s name to AlgorithmNode.
Definition: ControlFlowGraph.h:194
concurrency::recursive_CF::ControlFlowGraph::m_decisionNameToDecisionHubMap
DecisionHubsMap m_decisionNameToDecisionHubMap
Index: map of decision&#39;s name to DecisionHub.
Definition: ControlFlowGraph.h:196
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:124
concurrency::recursive_CF::ControlFlowGraph::m_nodeCounter
unsigned int m_nodeCounter
Total number of nodes in the graph.
Definition: ControlFlowGraph.h:198
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

StatusCode concurrency::recursive_CF::ControlFlowGraph::addDecisionHubNode | ( | Algorithm * | daughterAlgo,
|  | const std::string & | parentName,
|  | bool | modeConcurrent,
|  | bool | modePromptDecision,
|  | bool | modeOR,
|  | bool | allPass
| ) |  |

Add a node, which aggregates decisions of direct daughter nodes.

Definition at line 181 of file ControlFlowGraph.cpp.

184 {
185
186 StatusCode sc = StatusCode::SUCCESS;
187
188 auto& decisionHubName = decisionHubAlgo->name();
189
190 auto itP = m_decisionNameToDecisionHubMap.find( parentName );
191 concurrency::recursive_CF::DecisionNode* parentNode;
192 if ( itP != m_decisionNameToDecisionHubMap.end() ) {
193 parentNode = itP->second;
194 auto itA = m_decisionNameToDecisionHubMap.find( decisionHubName );
195 concurrency::recursive_CF::DecisionNode* decisionHubNode;
196 if ( itA != m_decisionNameToDecisionHubMap.end() ) {
197 decisionHubNode = itA->second;
198 } else {
199 decisionHubNode = new concurrency::recursive_CF::DecisionNode(
200 *this, m_nodeCounter, decisionHubName, modeConcurrent, modePromptDecision, modeOR, allPass );
201 ++m_nodeCounter;
202 m_decisionNameToDecisionHubMap[decisionHubName] = decisionHubNode;
203 if ( msgLevel( MSG::VERBOSE ) )
204 verbose() << "Decision hub node " << decisionHubName << " added @ " << decisionHubNode << endmsg;
205 }
206
207 parentNode->addDaughterNode( decisionHubNode );
208 } else {
209 sc = StatusCode::FAILURE;
210 error() << "Decision hub node " << parentName << ", requested to be parent, is not registered." << endmsg;
211 }
212
213 return sc;
214 }
concurrency::recursive_CF::DecisionNode::addDaughterNode
void addDaughterNode(ControlFlowNode *node)
Add a daughter node.
Definition: ControlFlowGraph.cpp:37
StatusCode::SUCCESS
Definition: StatusCode.h:31
StatusCode::FAILURE
Definition: StatusCode.h:31
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:118
concurrency::recursive_CF::DecisionNode
Definition: ControlFlowGraph.h:57
std::unordered_map::end
T end(T...args)
MSG::VERBOSE
Definition: IMessageSvc.h:16
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:106
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
std::unordered_map::find
T find(T...args)
concurrency::recursive_CF::ControlFlowGraph::m_decisionNameToDecisionHubMap
DecisionHubsMap m_decisionNameToDecisionHubMap
Index: map of decision&#39;s name to DecisionHub.
Definition: ControlFlowGraph.h:196
CommonMessagingBase::msgLevel
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Definition: CommonMessaging.h:124
concurrency::recursive_CF::ControlFlowGraph::m_nodeCounter
unsigned int m_nodeCounter
Total number of nodes in the graph.
Definition: ControlFlowGraph.h:198
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

void concurrency::recursive_CF::ControlFlowGraph::addHeadNode | ( | const std::string & | headName,
|  | bool | modeConcurrent,
|  | bool | modePromptDecision,
|  | bool | modeOR,
|  | bool | allPass
| ) |  |

Add a node, which has no parents.

Definition at line 217 of file ControlFlowGraph.cpp.

219 {
220
221 auto itH = m_decisionNameToDecisionHubMap.find( headName );
222 if ( itH != m_decisionNameToDecisionHubMap.end() ) {
223 m_headNode = itH->second;
224 } else {
225 m_headNode = new concurrency::recursive_CF::DecisionNode( *this, m_nodeCounter, headName, modeConcurrent,
226 modePromptDecision, modeOR, allPass );
227 ++m_nodeCounter;
228 m_decisionNameToDecisionHubMap[headName] = m_headNode;
229 }
230 }
concurrency::recursive_CF::DecisionNode
Definition: ControlFlowGraph.h:57
std::unordered_map::end
T end(T...args)
std::unordered_map::find
T find(T...args)
concurrency::recursive_CF::ControlFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ControlFlowGraph.h:192
concurrency::recursive_CF::ControlFlowGraph::m_decisionNameToDecisionHubMap
DecisionHubsMap m_decisionNameToDecisionHubMap
Index: map of decision&#39;s name to DecisionHub.
Definition: ControlFlowGraph.h:196
concurrency::recursive_CF::ControlFlowGraph::m_nodeCounter
unsigned int m_nodeCounter
Total number of nodes in the graph.
Definition: ControlFlowGraph.h:198

std::string concurrency::recursive_CF::ControlFlowGraph::dumpControlFlow | ( |  | ) | const

Print out control flow of Algorithms and Sequences.

Definition at line 239 of file ControlFlowGraph.cpp.

240 {
241 std::ostringstream ost;
242 dumpControlFlow( ost, m_headNode, 0 );
243 return ost.str();
244 }
concurrency::recursive_CF::ControlFlowGraph::dumpControlFlow
std::string dumpControlFlow() const
Print out control flow of Algorithms and Sequences.
Definition: ControlFlowGraph.cpp:239
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)
concurrency::recursive_CF::ControlFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ControlFlowGraph.h:192

void concurrency::recursive_CF::ControlFlowGraph::dumpControlFlow | ( | std::ostringstream & | ost,
|  | ControlFlowNode * | node,
|  | const int & | indent
| ) |  | const

Definition at line 247 of file ControlFlowGraph.cpp.

248 {
249 ost << std::string( indent * 2, ' ' );
250 DecisionNode* dn = dynamic_cast<DecisionNode*>( node );
251 AlgorithmNode* an = dynamic_cast<AlgorithmNode*>( node );
252 if ( dn != 0 ) {
253 if ( node != m_headNode ) {
254 ost << node->getNodeName() << " [Seq] ";
255 ost << ( ( dn->m_modeConcurrent ) ? " [Concurrent] " : " [Sequential] " );
256 ost << ( ( dn->m_modePromptDecision ) ? " [Prompt] " : "" );
257 ost << ( ( dn->m_modeOR ) ? " [OR] " : "" );
258 ost << ( ( dn->m_allPass ) ? " [PASS] " : "" );
259 ost << "\n";
260 }
261 const std::vector<ControlFlowNode*>& dth = dn->getDaughters();
262 for ( std::vector<ControlFlowNode*>::const_iterator itr = dth.begin(); itr != dth.end(); ++itr ) {
263 dumpControlFlow( ost, *itr, indent + 1 );
264 }
265 } else if ( an != 0 ) {
266 ost << node->getNodeName() << " [Alg] ";
267 if ( an != 0 ) {
268 auto ar = an->getAlgorithm();
269 ost << " [n= " << ar->cardinality() << "]";
270 ost << ( ( !ar->isClonable() ) ? " [unclonable] " : "" );
271 }
272 ost << "\n";
273 }
274 }
concurrency::recursive_CF::ControlFlowGraph::dumpControlFlow
std::string dumpControlFlow() const
Print out control flow of Algorithms and Sequences.
Definition: ControlFlowGraph.cpp:239
std::vector::end
T end(T...args)
std::string
STL class.
std::vector
STL class.
std::vector::begin
T begin(T...args)
concurrency::recursive_CF::ControlFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ControlFlowGraph.h:192

unsigned int concurrency::recursive_CF::ControlFlowGraph::getControlFlowNodeCounter | ( |  | ) | const
| inline

Get total number of graph nodes.

Definition at line 172 of file ControlFlowGraph.h.

172 { return m_nodeCounter; }
concurrency::recursive_CF::ControlFlowGraph::m_nodeCounter
unsigned int m_nodeCounter
Total number of nodes in the graph.
Definition: ControlFlowGraph.h:198

DecisionNode* concurrency::recursive_CF::ControlFlowGraph::getHeadNode | ( |  | ) | const
| inline

Get head node.

Definition at line 164 of file ControlFlowGraph.h.

164 { return m_headNode; };
concurrency::recursive_CF::ControlFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ControlFlowGraph.h:192

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

Initialize graph.

Definition at line 140 of file ControlFlowGraph.cpp.

141 {
142 m_headNode->initialize( algname_index_map );
143 }
concurrency::recursive_CF::DecisionNode::initialize
void initialize(const std::unordered_map< std::string, unsigned int > &algname_index_map) override
Initialize.
Definition: ControlFlowGraph.cpp:30
concurrency::recursive_CF::ControlFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ControlFlowGraph.h:192

const std::string& concurrency::recursive_CF::ControlFlowGraph::name | ( |  | ) | const
| inline override

Retrieve name of the service.

Definition at line 182 of file ControlFlowGraph.h.

182 { return m_name; }
concurrency::recursive_CF::ControlFlowGraph::m_name
const std::string m_name
Definition: ControlFlowGraph.h:203

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

Print a string representing the control flow state.

Definition at line 176 of file ControlFlowGraph.h.

178 {
179 m_headNode->printState( output, states, node_decisions, recursionLevel );
180 }
concurrency::recursive_CF::DecisionNode::printState
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.
Definition: ControlFlowGraph.cpp:44
concurrency::recursive_CF::ControlFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ControlFlowGraph.h:192

SmartIF<ISvcLocator>& concurrency::recursive_CF::ControlFlowGraph::serviceLocator | ( |  | ) | const
| inline override

Retrieve pointer to service locator.

Definition at line 184 of file ControlFlowGraph.h.

184 { return m_svcLocator; }
concurrency::recursive_CF::ControlFlowGraph::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Service locator (needed to access the MessageSvc)
Definition: ControlFlowGraph.h:202

void concurrency::recursive_CF::ControlFlowGraph::updateEventState | ( | AlgsExecutionStates & | states,
|  | std::vector< int > & | node_decisions
| ) |  | const

Start revision of states and decisions.

Definition at line 233 of file ControlFlowGraph.cpp.

234 {
235 m_headNode->updateState( algo_states, node_decisions );
236 }
concurrency::recursive_CF::DecisionNode::updateState
int updateState(AlgsExecutionStates &states, std::vector< int > &node_decisions) const override
Method to set algos to CONTROLREADY, if possible.
Definition: ControlFlowGraph.cpp:57
concurrency::recursive_CF::ControlFlowGraph::m_headNode
DecisionNode * m_headNode
the head node of the control flow graph; may want to have multiple ones once supporting trigger paths...
Definition: ControlFlowGraph.h:192

## Member Data Documentation

unsigned int concurrency::recursive_CF::ControlFlowGraph::m_algoCounter {0}
| private

Total number of algorithm nodes in the graph.

Definition at line 200 of file ControlFlowGraph.h.

AlgoNodesMap concurrency::recursive_CF::ControlFlowGraph::m_algoNameToAlgoNodeMap
| private

Index: map of algorithm's name to AlgorithmNode.

Definition at line 194 of file ControlFlowGraph.h.

DecisionHubsMap concurrency::recursive_CF::ControlFlowGraph::m_decisionNameToDecisionHubMap
| private

Index: map of decision's name to DecisionHub.

Definition at line 196 of file ControlFlowGraph.h.

DecisionNode* concurrency::recursive_CF::ControlFlowGraph::m_headNode {nullptr}
| private

the head node of the control flow graph; may want to have multiple ones once supporting trigger paths

Definition at line 192 of file ControlFlowGraph.h.

const std::string concurrency::recursive_CF::ControlFlowGraph::m_name
| private

Definition at line 203 of file ControlFlowGraph.h.

unsigned int concurrency::recursive_CF::ControlFlowGraph::m_nodeCounter {0}
| private

Total number of nodes in the graph.

Definition at line 198 of file ControlFlowGraph.h.

SmartIF<ISvcLocator> concurrency::recursive_CF::ControlFlowGraph::m_svcLocator
| mutable private

Service locator (needed to access the MessageSvc)

Definition at line 202 of file ControlFlowGraph.h.

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

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