| The Gaudi Framework v27r1

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

- File List
- File Members

ExecutionFlowManager.h
Go to the documentation of this file.
1 #ifndef EXECUTIONFLOWMANAGER_H_
2 #define EXECUTIONFLOWMANAGER_H_
3
4 #include "ExecutionFlowGraph.h"
5 #include "EFGraphVisitors.h"
6
7 namespace concurrency {
8
9 struct IExecutionFlowManager {
10 virtual ~IExecutionFlowManager() {}
11 };
12
21 class ExecutionFlowManager : public CommonMessaging<IExecutionFlowManager> {
22 public:
24 ExecutionFlowManager() : m_name("ExecutionFlowManager"), m_EFGraph(0) {};
26 ~ExecutionFlowManager() override = default;
29 StatusCode initialize(ExecutionFlowGraph* CFGraph,
30 const std::unordered_map<std::string,unsigned int>& algname_index_map);
31 StatusCode initialize(ExecutionFlowGraph* CFGraph,
32 const std::unordered_map<std::string,unsigned int>& algname_index_map,
33 std::vector<EventSlot>& eventSlots,
34 const std::string& mode);
36 void simulateExecutionFlow(IGraphVisitor& visitor) const;
38 inline ExecutionFlowGraph* getExecutionFlowGraph() const {return m_EFGraph;}
40 bool needsAlgorithmToRun(const unsigned int iAlgo) const;
42 void updateEventState(AlgsExecutionStates & algo_states,
43 std::vector<int>& node_decisions) const;
45 void updateDecision(const std::string& algo_name,
46 const int& slotNum,
47 AlgsExecutionStates& states,
48 std::vector<int>& node_decisions) const;
50 void updateEventState(AlgsExecutionStates& algo_states) const;
52 void promoteToControlReadyState(AlgsExecutionStates& algo_states,
53 std::vector<int>& node_decisions,
54 const int& slotNum=-1) const;
56 bool algoDataDependenciesSatisfied(const std::string& algo_name, const int& slotNum) const;
58 bool rootDecisionResolved(const std::vector<int>& node_decisions) const;
60 void printEventState(std::stringstream& ss,
61 AlgsExecutionStates& states,
62 const std::vector<int>& node_decisions,
63 const unsigned int& recursionLevel) const {m_EFGraph->printState(ss,states,node_decisions,recursionLevel);}
65 void touchReadyAlgorithms(IGraphVisitor& visitor) const;
67 const std::string& name() const override {return m_name;}
69 SmartIF<ISvcLocator>& serviceLocator() const override {return m_EFGraph->serviceLocator();}
70 private:
71 std::string m_name;
73 ExecutionFlowGraph* m_EFGraph;
74 };
75
76 } // namespace concurrency
77
78 #endif /* EXECUTIONFLOWMANAGER_H_ */
concurrency::ExecutionFlowManager::simulateExecutionFlow
void simulateExecutionFlow(IGraphVisitor &visitor) const
Definition: ExecutionFlowManager.cpp:53
SmartIF< ISvcLocator >
concurrency::ExecutionFlowManager::ExecutionFlowManager
ExecutionFlowManager()
Constructor.
Definition: ExecutionFlowManager.h:24
concurrency::ExecutionFlowManager::updateEventState
void updateEventState(AlgsExecutionStates &algo_states, std::vector< int > &node_decisions) const
Update the state of algorithms to controlready, where possible.
Definition: ExecutionFlowManager.cpp:95
concurrency::ExecutionFlowManager::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: ExecutionFlowManager.h:69
concurrency::ExecutionFlowManager::printEventState
void printEventState(std::stringstream &ss, AlgsExecutionStates &states, const std::vector< int > &node_decisions, const unsigned int &recursionLevel) const
Print the state of the control flow for a given event.
Definition: ExecutionFlowManager.h:60
concurrency::IExecutionFlowManager::~IExecutionFlowManager
virtual ~IExecutionFlowManager()
Definition: ExecutionFlowManager.h:10
concurrency::ExecutionFlowManager::algoDataDependenciesSatisfied
bool algoDataDependenciesSatisfied(const std::string &algo_name, const int &slotNum) const
Check all data dependencies of an algorithm are satisfied.
Definition: ExecutionFlowManager.cpp:116
concurrency
Definition: EFGraphVisitors.cpp:3
concurrency::ExecutionFlowManager::name
const std::string & name() const override
Retrieve name of the service.
Definition: ExecutionFlowManager.h:67
concurrency::ExecutionFlowManager::touchReadyAlgorithms
void touchReadyAlgorithms(IGraphVisitor &visitor) const
Promote all algorithms, ready to be executed, to DataReady state.
Definition: ExecutionFlowManager.cpp:127
std::stringstream
STL class.
std::string
STL class.
concurrency::ExecutionFlowManager::m_name
std::string m_name
Definition: ExecutionFlowManager.h:71
concurrency::ExecutionFlowManager::updateDecision
void updateDecision(const std::string &algo_name, const int &slotNum, AlgsExecutionStates &states, std::vector< int > &node_decisions) const
Definition: ExecutionFlowManager.cpp:101
concurrency::ExecutionFlowManager::rootDecisionResolved
bool rootDecisionResolved(const std::vector< int > &node_decisions) const
Check whether root decision was resolved.
Definition: ExecutionFlowManager.cpp:121
AlgsExecutionStates
The AlgsExecutionStates encodes the state machine for the execution of algorithms within a single eve...
Definition: AlgsExecutionStates.h:28
concurrency::ExecutionFlowManager
Manage the execution flow using an execution flow graph Once initialized, the graph is const and can ...
Definition: ExecutionFlowManager.h:21
concurrency::ExecutionFlowGraph::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: ExecutionFlowGraph.h:333
concurrency::ExecutionFlowManager::promoteToControlReadyState
void promoteToControlReadyState(AlgsExecutionStates &algo_states, std::vector< int > &node_decisions, const int &slotNum=-1) const
XXX: CF tests.
Definition: ExecutionFlowManager.cpp:109
concurrency::ExecutionFlowManager::m_EFGraph
ExecutionFlowGraph * m_EFGraph
the control flow graph
Definition: ExecutionFlowManager.h:73
concurrency::ExecutionFlowGraph::printState
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.
Definition: ExecutionFlowGraph.h:324
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
concurrency::IGraphVisitor
Definition: IGraphVisitor.h:9
EFGraphVisitors.h
std::vector< EventSlot >
concurrency::IExecutionFlowManager
Definition: ExecutionFlowManager.h:9
concurrency::ExecutionFlowGraph
Definition: ExecutionFlowGraph.h:271
CommonMessaging
Definition: CommonMessaging.h:58
concurrency::ExecutionFlowManager::~ExecutionFlowManager
~ExecutionFlowManager() override=default
Destructor.
concurrency::ExecutionFlowManager::getExecutionFlowGraph
ExecutionFlowGraph * getExecutionFlowGraph() const
Get the flow graph instance.
Definition: ExecutionFlowManager.h:38
concurrency::ExecutionFlowManager::initialize
StatusCode initialize(ExecutionFlowGraph *CFGraph, const std::unordered_map< std::string, unsigned int > &algname_index_map)
Initialize the control flow manager It greps the topalg list and the index map for the algo names...
Definition: ExecutionFlowManager.cpp:6
concurrency::ExecutionFlowManager::needsAlgorithmToRun
bool needsAlgorithmToRun(const unsigned int iAlgo) const
A little bit silly, but who cares. ;-)
ExecutionFlowGraph.h
std::unordered_map< std::string, unsigned int >