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