RTC Toolkit 5.0.0
Loading...
Searching...
No Matches
stateSubscriber.hpp
Go to the documentation of this file.
1
13#ifndef RTCTK_COMPONENTFRAMEWORK_STATESUBSCRIBER_HPP
14#define RTCTK_COMPONENTFRAMEWORK_STATESUBSCRIBER_HPP
15
16#include <mal/utility/Uri.hpp>
17#include <taiclock/taiClock.hpp>
18
19#include <functional>
20#include <memory>
21#include <vector>
22
23namespace elt::mal::ps {
24template <typename TOPIC_TYPE>
26
27class Subscription;
28} // namespace elt::mal::ps
29
30namespace stdif {
31class State;
32}
33
35
42public:
43 using Callback = std::function<void(const taiclock::TaiClock::time_point time,
44 const std::string& name,
45 const std::string& state)>;
46
47 StateSubscriber(const elt::mal::Uri& uri, Callback on_state_change);
48 StateSubscriber(const std::vector<elt::mal::Uri>& uri_list, Callback on_state_change);
49
50 // no copy allowed
53
54 // move it instead
57
58 virtual ~StateSubscriber() = default;
59
60private:
61 // cppcheck-suppress-begin unusedStructMember
62
63 std::vector<std::unique_ptr<elt::mal::ps::Subscriber<stdif::State>>> m_subscribers;
64 std::vector<std::unique_ptr<elt::mal::ps::Subscription>> m_subscriptions;
65
66 // cppcheck-suppress-end unusedStructMember
67};
68
69} // namespace rtctk::componentFramework
70
71#endif // RTCTK_COMPONENTFRAMEWORK_STATESUBSCRIBER_HPP
Definition stateSubscriber.hpp:25
Class used to subscribe to state-changed-topic using MAL.
Definition stateSubscriber.hpp:41
StateSubscriber & operator=(StateSubscriber &&other)=default
StateSubscriber(const StateSubscriber &other)=delete
StateSubscriber & operator=(const StateSubscriber &other)=delete
StateSubscriber(StateSubscriber &&other)=default
std::function< void(const taiclock::TaiClock::time_point time, const std::string &name, const std::string &state)> Callback
Definition stateSubscriber.hpp:43
StateSubscriber(const elt::mal::Uri &uri, Callback on_state_change)
Definition stateSubscriber.cpp:49
Definition statePublisher.hpp:20
Definition commandReplier.cpp:22
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
Definition statePublisher.hpp:25