All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
11  };
12 
21  class ExecutionFlowManager : public CommonMessaging<IExecutionFlowManager> {
22  public:
24  ExecutionFlowManager() : m_name("ExecutionFlowManager"), m_EFGraph(0) {};
26  ~ExecutionFlowManager() override = default;
30  const std::unordered_map<std::string,unsigned int>& algname_index_map);
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;
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;
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;}
70  private:
71  std::string m_name;
74  };
75 
76 } // namespace concurrency
77 
78 #endif /* EXECUTIONFLOWMANAGER_H_ */
void simulateExecutionFlow(IGraphVisitor &visitor) const
void updateEventState(AlgsExecutionStates &algo_states, std::vector< int > &node_decisions) const
Update the state of algorithms to controlready, where possible.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
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.
bool algoDataDependenciesSatisfied(const std::string &algo_name, const int &slotNum) const
Check all data dependencies of an algorithm are satisfied.
const std::string & name() const override
Retrieve name of the service.
void touchReadyAlgorithms(IGraphVisitor &visitor) const
Promote all algorithms, ready to be executed, to DataReady state.
void updateDecision(const std::string &algo_name, const int &slotNum, AlgsExecutionStates &states, std::vector< int > &node_decisions) const
bool rootDecisionResolved(const std::vector< int > &node_decisions) const
Check whether root decision was resolved.
The AlgsExecutionStates encodes the state machine for the execution of algorithms within a single eve...
Manage the execution flow using an execution flow graph Once initialized, the graph is const and can ...
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
void promoteToControlReadyState(AlgsExecutionStates &algo_states, std::vector< int > &node_decisions, const int &slotNum=-1) const
XXX: CF tests.
ExecutionFlowGraph * m_EFGraph
the control flow graph
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.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
~ExecutionFlowManager() override=default
Destructor.
ExecutionFlowGraph * getExecutionFlowGraph() const
Get the flow graph instance.
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...
bool needsAlgorithmToRun(const unsigned int iAlgo) const
A little bit silly, but who cares. ;-)