RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
loopCmdsImpl.hpp
Go to the documentation of this file.
1
11
12#ifndef RTCTK_COMPONENTFRAMEWORK_LOOPCMDSIMPL_HPP
13#define RTCTK_COMPONENTFRAMEWORK_LOOPCMDSIMPL_HPP
14
15#include <Rtctkif.hpp>
17#include <rtctk/componentFramework/events.rad.hpp>
21
22#include <mal/Cii.hpp>
23
24#include <memory>
25#include <string>
26
28
34class LoopCmdsImpl : public rtctkif::AsyncLoopCmds {
35public:
36 static void Register(CommandReplier& replier, StateMachineEngine& engine) {
37 std::shared_ptr<elt::mal::rr::RrEntity> rr_service = std::make_shared<LoopCmdsImpl>(engine);
38 replier.RegisterService<rtctkif::AsyncLoopCmds>("LoopCmds", rr_service);
39 }
40
42 : m_logger(GetLogger("rtctk")), m_engine(engine) {
43 }
44
45 ::elt::mal::future<std::string> Open() override {
46 LOG4CPLUS_TRACE(m_logger, "Received command 'Open'");
47 return InjectReqRepEvent<events::Open>(m_engine);
48 }
49
50 ::elt::mal::future<std::string> Close() override {
51 LOG4CPLUS_TRACE(m_logger, "Received command 'Close'");
52 return InjectReqRepEvent<events::Close>(m_engine);
53 }
54
55private:
56 log4cplus::Logger& m_logger;
57 StateMachineEngine& m_engine;
58};
59
60} // namespace rtctk::componentFramework
61
62#endif
Class that handles reception of commands using MAL.
Definition commandReplier.hpp:29
void RegisterService(const std::string &name, std::shared_ptr< elt::mal::rr::RrEntity > &service)
Definition commandReplier.hpp:36
static void Register(CommandReplier &replier, StateMachineEngine &engine)
Definition loopCmdsImpl.hpp:36
LoopCmdsImpl(StateMachineEngine &engine)
Definition loopCmdsImpl.hpp:41
::elt::mal::future< std::string > Open() override
Definition loopCmdsImpl.hpp:45
::elt::mal::future< std::string > Close() override
Definition loopCmdsImpl.hpp:50
Definition stateMachineEngine.hpp:34
Receive commands via MAL.
log4cplus::Logger & GetLogger(const std::string &name="app")
Get handle to a specific logger.
Definition logger.cpp:191
Logging Support Library based on log4cplus.
Provides core functionality of an RTC Component.
Definition commandReplier.cpp:21
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:22
Wrapper around the SCXML State Machine Engine.