ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
actionMgr.cpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup server
4  * @copyright ESO - European Southern Observatory
5  * @author
6  *
7  * @brief ActionMgr class source file.
8  */
9 
10 #include "actionMgr.hpp"
11 #include "actionsStd.hpp"
12 #include "dataContext.hpp"
13 #include "logger.hpp"
14 
15 #include <rad/actionGroup.hpp>
16 #include <rad/assert.hpp>
17 #include <rad/actionCallback.hpp>
18 
19 #include <functional>
20 
21 namespace server {
22 
24  RAD_TRACE(GetLogger());
25 }
26 
28  RAD_TRACE(GetLogger());
29 }
30 
31 void ActionMgr::CreateActions(boost::asio::io_service& ios,
32  rad::SMAdapter& sm,
33  DataContext& the_data) {
34  RAD_TRACE(GetLogger());
35 
36  /*
37  * Create action group classes
38  */
39 
40  ActionsStd* actions_std = new ActionsStd(ios, sm, the_data);
41  if (actions_std == nullptr) {
42  LOG4CPLUS_ERROR(GetLogger(), "Cannot create actions_std object.");
43  // @TODO throw exception
44  return;
45  }
46  AddActionGroup(actions_std);
47 
48  /*
49  * Create SM call-backs
50  */
51 
52  scxml4cpp::Action* the_action = nullptr;
53 
54  using std::placeholders::_1;
55 
56  the_action = new rad::ActionCallback(
57  "ActionsStd.GetState",
58  std::bind(&ActionsStd::GetState, actions_std, _1));
59  AddAction(the_action);
60 
61  the_action = new rad::ActionCallback(
62  "ActionsStd.GetStatus",
63  std::bind(&ActionsStd::GetStatus, actions_std, _1));
64  AddAction(the_action);
65 
66  the_action = new rad::ActionCallback(
67  "ActionsStd.Stop",
68  std::bind(&ActionsStd::Stop, actions_std, _1));
69  AddAction(the_action);
70 
71  the_action = new rad::ActionCallback(
72  "ActionsStd.Init",
73  std::bind(&ActionsStd::Init, actions_std, _1));
74  AddAction(the_action);
75 
76  the_action = new rad::ActionCallback(
77  "ActionsStd.Enable",
78  std::bind(&ActionsStd::Enable, actions_std, _1));
79  AddAction(the_action);
80 
81  the_action = new rad::ActionCallback(
82  "ActionsStd.Disable",
83  std::bind(&ActionsStd::Disable, actions_std, _1));
84  AddAction(the_action);
85 
86  the_action = new rad::ActionCallback(
87  "ActionsStd.Reset",
88  std::bind(&ActionsStd::Reset, actions_std, _1));
89  AddAction(the_action);
90 
91  the_action = new rad::ActionCallback(
92  "ActionsStd.SetLogLevel",
93  std::bind(&ActionsStd::SetLogLevel, actions_std, _1));
94  AddAction(the_action);
95 
96  the_action = new rad::ActionCallback(
97  "ActionsStd.Exit",
98  std::bind(&ActionsStd::Exit, actions_std, _1));
99  AddAction(the_action);
100 
101  the_action = new rad::ActionCallback(
102  "ActionsStd.ExitNoReply",
103  std::bind(&ActionsStd::ExitNoReply, actions_std, _1));
104  AddAction(the_action);
105 }
106 
107 void ActionMgr::CreateActivities(rad::SMAdapter& sm, DataContext& the_data) {
108  RAD_TRACE(GetLogger());
109 }
110 
111 } // namespace server
ActionMgr class header file.
ActionsStd class header file.
virtual ~ActionMgr()
Default destructor.
Definition: actionMgr.cpp:27
void CreateActivities(rad::SMAdapter &sm, DataContext &the_data)
Method to instantiate activity objects.
Definition: actionMgr.cpp:107
ActionMgr()
Default constructor.
Definition: actionMgr.cpp:23
void CreateActions(boost::asio::io_service &ios, rad::SMAdapter &sm, DataContext &the_data)
Method to instantiate the action objects.
Definition: actionMgr.cpp:31
This class contains the implementation of the actions dealing with the standard commands from stdif....
Definition: actionsStd.hpp:51
void Init(scxml4cpp::Context *c)
Implementation of the Init action.
Definition: actionsStd.cpp:126
void Enable(scxml4cpp::Context *c)
Implementation of the Enable action.
Definition: actionsStd.cpp:137
void GetState(scxml4cpp::Context *c)
Implementation of the GetState action.
Definition: actionsStd.cpp:91
void GetStatus(scxml4cpp::Context *c)
Implementation of the GetStatus action.
Definition: actionsStd.cpp:102
void SetLogLevel(scxml4cpp::Context *c)
Implementation of the SetLogLevel action.
Definition: actionsStd.cpp:170
void Disable(scxml4cpp::Context *c)
Implementation of the Disable action.
Definition: actionsStd.cpp:148
void Stop(scxml4cpp::Context *c)
Implementation of the Stop action.
Definition: actionsStd.cpp:115
void ExitNoReply(scxml4cpp::Context *c)
Implementation of the ExitNoReply action.
Definition: actionsStd.cpp:86
void Exit(scxml4cpp::Context *c)
Implementation of the Exit action.
Definition: actionsStd.cpp:74
void Reset(scxml4cpp::Context *c)
Implementation of the Reset action.
Definition: actionsStd.cpp:159
This class provide access to the application run-time data including the in-memory DB.
Definition: dataContext.hpp:21
DataContext class header file.
Default logger name.
log4cplus::Logger & GetLogger()
Definition: logger.cpp:14