ifw-ocf  2.0.0-dev
 All Classes Namespaces Files Functions Variables Groups
stateMachine.hpp
Go to the documentation of this file.
1 
8 #ifndef OCM_SERVER_DAQ_STATE_MACHINE_HPP
9 #define OCM_SERVER_DAQ_STATE_MACHINE_HPP
10 
11 #include <list>
12 #include <functional>
13 
14 //#include <gsl/span>
15 #include <rad/anyEvent.hpp>
16 #include <rad/actionMgr.hpp>
17 #include <scxml4cpp/Action.h>
18 #include <scxml4cpp/Activity.h>
19 #include <scxml4cpp/Context.h>
20 #include <scxml4cpp/EventQueue.h>
21 #include <scxml4cpp/Executor.h>
22 #include <scxml4cpp/StateMachine.h>
23 
24 namespace daq {
25 class Context : public scxml4cpp::Context {
26 public:
27  explicit Context(std::string daq_id);
28  Context(Context const&) = delete;
29  Context(Context &&) = default;
30 
31  std::string m_daq_id;
32 };
33 
34 
35 
42 class StateMachine {
43  public:
49  explicit StateMachine(Context& ctx,
50  std::string const& model_file,
51  std::list<scxml4cpp::Action*>& actions,
52  std::list<scxml4cpp::Activity*>& activities);
53  ~StateMachine();
54 
56  StateMachine(StateMachine&&) = default;
58  StateMachine(StateMachine const&) = delete;
59  StateMachine& operator=(StateMachine const&) = delete;
60 
61 
62  void ProcessEvent(rad::AnyEvent const& ev);
63 
64  private:
65  Context& m_context;
66  scxml4cpp::EventQueue m_event_queue;
67  scxml4cpp::StateMachine m_model;
68  scxml4cpp::Executor m_executor;
69 
70 };
71 
76 class DaqSmManager {
77 public:
78  rad::ActionMgr m_action_mgr;
81 };
82 
89 std::function<StateMachine(std::string)>
91  std::string const& model_file,
92  std::list<scxml4cpp::Action*>& actions,
93  std::list<scxml4cpp::Activity*>& activities);
94 
95 }
96 #endif // #ifndef OCM_SERVER_DAQ_STATE_MACHINE_HPP
Context m_context
Definition: stateMachine.hpp:79
Definition: stateMachine.hpp:76
StateMachine(Context &ctx, std::string const &model_file, std::list< scxml4cpp::Action * > &actions, std::list< scxml4cpp::Activity * > &activities)
Definition: stateMachine.cpp:19
Definition: stateMachine.hpp:42
std::string m_daq_id
Definition: stateMachine.hpp:31
rad::ActionMgr m_action_mgr
Definition: stateMachine.hpp:78
StateMachine & operator=(StateMachine const &)=delete
Definition: stateMachine.hpp:25
StateMachine m_sm
Definition: stateMachine.hpp:80
void ProcessEvent(rad::AnyEvent const &ev)
std::function< StateMachine(std::string)> MakeStateMachineFactory(Context &ctx, std::string const &model_file, std::list< scxml4cpp::Action * > &actions, std::list< scxml4cpp::Activity * > &activities)
Context(std::string daq_id)
Definition: stateMachine.cpp:16
~StateMachine()
Definition: stateMachine.cpp:37