RTC Toolkit 5.0.0
Loading...
Searching...
No Matches
commandReplier.hpp
Go to the documentation of this file.
1
13#ifndef RTCTK_COMPONENTFRAMEWORK_COMMANDREPLIER_HPP
14#define RTCTK_COMPONENTFRAMEWORK_COMMANDREPLIER_HPP
15
16#include <mal/Mal.hpp>
17#include <mal/rr/RrEntity.hpp>
18#include <mal/rr/Server.hpp>
19#include <mal/utility/Uri.hpp>
20#include <memory>
21#include <thread>
22
24
31public:
32 explicit CommandReplier(const ::elt::mal::Uri& uri);
33 virtual ~CommandReplier();
34
35 template <typename T>
36 void
37 RegisterService(const std::string& name, std::shared_ptr<elt::mal::rr::RrEntity>& service) {
38 m_rr_server->registerService<T, false>(name, service);
39 }
40
41 std::vector<std::pair<std::string, std::string>>
42 GetServiceDescriptions(const std::string& service_name = std::string()) {
43 return m_rr_server->getServiceDescriptions(service_name);
44 }
45
46 std::shared_ptr<elt::mal::Mal> GetMal() {
47 return m_mal;
48 }
49
50private:
51 std::shared_ptr<elt::mal::Mal> m_mal;
52 std::unique_ptr<elt::mal::rr::Server> m_rr_server;
53 std::thread m_rr_thread;
54};
55} // namespace rtctk::componentFramework
56
57#endif
Class that handles reception of commands using MAL.
Definition commandReplier.hpp:30
void RegisterService(const std::string &name, std::shared_ptr< elt::mal::rr::RrEntity > &service)
Definition commandReplier.hpp:37
std::vector< std::pair< std::string, std::string > > GetServiceDescriptions(const std::string &service_name=std::string())
Definition commandReplier.hpp:42
CommandReplier(const ::elt::mal::Uri &uri)
Definition commandReplier.cpp:23
std::shared_ptr< elt::mal::Mal > GetMal()
Definition commandReplier.hpp:46
virtual ~CommandReplier()
Definition commandReplier.cpp:37
Definition commandReplier.cpp:22
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23