rad  3.0.0
stdCmdsImpl.hpp
Go to the documentation of this file.
1 
9 #ifndef HELLOMAL_STD_CMDS_IMPL_HPP_
10 #define HELLOMAL_STD_CMDS_IMPL_HPP_
11 
12 #include "events.rad.hpp"
13 #include "logger.hpp"
14 
15 #include <rad/exceptions.hpp>
16 #include <rad/smAdapter.hpp>
17 
18 namespace hellomal {
19 
21 public:
22  explicit StdCmdsImpl(rad::SMAdapter& sm) : m_sm(sm) {
24  }
25 
26  virtual ~StdCmdsImpl() {
28  }
29 
30  virtual elt::mal::future<std::string> Exit() override {
32  auto ev = std::make_shared<Events::Exit>();
33  m_sm.PostEvent(ev);
34  return ev->GetPayload().GetReplyFuture();
35  }
36 
37  virtual elt::mal::future<std::string> Init() override {
39  auto ev = std::make_shared<Events::Init>();
40  m_sm.PostEvent(ev);
41  return ev->GetPayload().GetReplyFuture();
42  }
43 
44  virtual elt::mal::future<std::string> Stop() override {
46  auto ev = std::make_shared<Events::Stop>();
47  m_sm.PostEvent(ev);
48  return ev->GetPayload().GetReplyFuture();
49  }
50 
51  virtual elt::mal::future<std::string> Reset() override {
53  auto ev = std::make_shared<Events::Reset>();
54  m_sm.PostEvent(ev);
55  return ev->GetPayload().GetReplyFuture();
56  }
57 
58  virtual elt::mal::future<std::string> GetState() override {
60  auto ev = std::make_shared<Events::GetState>();
61  m_sm.PostEvent(ev);
62  return ev->GetPayload().GetReplyFuture();
63  }
64 
65  virtual elt::mal::future<std::string> GetStatus() override {
67  auto ev = std::make_shared<Events::GetStatus>();
68  m_sm.PostEvent(ev);
69  return ev->GetPayload().GetReplyFuture();
70  }
71 
72  virtual elt::mal::future<std::string> GetVersion() override {
74  auto ev = std::make_shared<Events::GetVersion>();
75  m_sm.PostEvent(ev);
76  return ev->GetPayload().GetReplyFuture();
77  }
78 
79  virtual elt::mal::future<std::string> Enable() override {
81  auto ev = std::make_shared<Events::Enable>();
82  m_sm.PostEvent(ev);
83  return ev->GetPayload().GetReplyFuture();
84  }
85 
86  virtual elt::mal::future<std::string> Disable() override {
88  auto ev = std::make_shared<Events::Disable>();
89  m_sm.PostEvent(ev);
90  return ev->GetPayload().GetReplyFuture();
91  }
92 
93  virtual elt::mal::future<std::string> SetLogLevel(const std::shared_ptr<hellomalif::LogInfo>& info) override {
95  auto ev = std::make_shared<Events::SetLogLevel>(info->clone());
96  m_sm.PostEvent(ev);
97  return ev->GetPayload().GetReplyFuture();
98  }
99 
100 private:
101  rad::SMAdapter& m_sm;
102 };
103 
104 } // namespace hellomal
105 
106 #endif // HELLOMAL_STD_CMDS_IMPL_HPP_
hellomal::StdCmdsImpl::Disable
virtual elt::mal::future< std::string > Disable() override
Definition: stdCmdsImpl.hpp:86
hellomalif::AsyncStdCmds
AsyncStdCmds.
Definition: Hellomalif.hpp:100
rad::SMAdapter
Definition: smAdapter.hpp:60
hellomal::StdCmdsImpl::Init
virtual elt::mal::future< std::string > Init() override
Definition: stdCmdsImpl.hpp:37
hellomal::StdCmdsImpl::SetLogLevel
virtual elt::mal::future< std::string > SetLogLevel(const std::shared_ptr< hellomalif::LogInfo > &info) override
Definition: stdCmdsImpl.hpp:93
hellomal
Definition: actionMgr.cpp:21
logger.hpp
Default logger name.
hellomal::StdCmdsImpl::StdCmdsImpl
StdCmdsImpl(rad::SMAdapter &sm)
Definition: stdCmdsImpl.hpp:22
hellomal::StdCmdsImpl::Stop
virtual elt::mal::future< std::string > Stop() override
Definition: stdCmdsImpl.hpp:44
hellomal::StdCmdsImpl::GetVersion
virtual elt::mal::future< std::string > GetVersion() override
Definition: stdCmdsImpl.hpp:72
hellomal::StdCmdsImpl::GetState
virtual elt::mal::future< std::string > GetState() override
Definition: stdCmdsImpl.hpp:58
hellomal::StdCmdsImpl::GetStatus
virtual elt::mal::future< std::string > GetStatus() override
Definition: stdCmdsImpl.hpp:65
hellomal::StdCmdsImpl::Reset
virtual elt::mal::future< std::string > Reset() override
Definition: stdCmdsImpl.hpp:51
rad::SMAdapter::PostEvent
void PostEvent(SharedEvent e)
Definition: smAdapter.cpp:214
hellomal::StdCmdsImpl::Exit
virtual elt::mal::future< std::string > Exit() override
Definition: stdCmdsImpl.hpp:30
RAD_TRACE
#define RAD_TRACE(logger)
Definition: logger.hpp:24
hellomal::StdCmdsImpl::~StdCmdsImpl
virtual ~StdCmdsImpl()
Definition: stdCmdsImpl.hpp:26
hellomal::StdCmdsImpl
Definition: stdCmdsImpl.hpp:20
hellomal::StdCmdsImpl::Enable
virtual elt::mal::future< std::string > Enable() override
Definition: stdCmdsImpl.hpp:79
hellomal::GetLogger
log4cplus::Logger & GetLogger()
Definition: logger.cpp:14