RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
repositorySubscriberIf.hpp
Go to the documentation of this file.
1
11
12#ifndef RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
13#define RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
14
16
18
27public:
28 // TODO: flesh out the details of this error type
29 // this likely will map to following dds reader callbacks:
30 // - on sample_rejected
31 // - on_sample_lost
32 // - on_request_deadline_missed
33 // - on request_incompatible_qos
35 public:
37 };
38
40 public:
41 SequenceIdMissmatch(const DataPointPath& path, RtcUInt64 expected, RtcUInt64 actual);
42 };
43
44 template <typename T>
45 using ValueCallbackType = std::function<void(const DataPointPath&, T&, const MetaData&)>;
46
47 using NotifyCallbackType = std::function<void(const DataPointPath&, const MetaData&)>;
48 using ErrorCallbackType = std::function<void(std::exception_ptr)>;
49
50 using SubscriptionId = size_t;
51
63 class RTCTK_API Subscription final {
64 public:
65 using UnsubscribeMethod = std::function<void()>;
66
69
70 Subscription(const Subscription&) = delete;
72
73 Subscription(Subscription&&) noexcept;
74 Subscription& operator=(Subscription&&) noexcept;
75
76 void Unsubscribe();
77
78 private:
79 UnsubscribeMethod m_unsubscribe;
80 };
81
90
92
123 template <typename T = void, typename F>
125 const F& cb_value,
126 const ErrorCallbackType& cb_error) const;
127
145 Subscription Subscribe(const CallbackType& cb_created,
146 const CallbackType& cb_deleted,
147 const ErrorCallbackType& cb_error) const;
148};
149
150} // namespace rtctk::componentFramework
151
153
154#endif // RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:76
friend RepositoryIf
Definition repositoryIf.hpp:927
Class for passing/receiving metadata to/from the repository.
Definition repositoryIf.hpp:145
std::function< void(const DataPointPath &)> CallbackType
Signature of the callback functions that can be registered with the repository requests.
Definition repositoryIf.hpp:60
void Unsubscribe(SubscriptionId) const
Definition repositorySubscriberIf.cpp:52
SubscriptionId Subscribe(const DataPointPath &, NotifyCallbackType, ErrorCallbackType) const
Definition repositorySubscriberIf.cpp:29
SequenceIdMissmatch(const DataPointPath &path, RtcUInt64 expected, RtcUInt64 actual)
Definition repositorySubscriberIf.cpp:17
RAII wrapper class used to manage the life-time of individual subscriptions.
Definition repositorySubscriberIf.hpp:63
std::function< void()> UnsubscribeMethod
Definition repositorySubscriberIf.hpp:65
void Unsubscribe()
Definition repositorySubscriberIf.cpp:85
Subscription(UnsubscribeMethod)
Definition repositorySubscriberIf.cpp:56
Subscription & operator=(const Subscription &)=delete
std::function< void(std::exception_ptr)> ErrorCallbackType
Definition repositorySubscriberIf.hpp:48
Subscription Subscribe(const DataPointPath &path, const F &cb_value, const ErrorCallbackType &cb_error) const
Subscribes to datapoint values change events by registering callbacks.
Definition repositorySubscriberIf.ipp:48
std::function< void(const DataPointPath &, T &, const MetaData &)> ValueCallbackType
Definition repositorySubscriberIf.hpp:45
std::function< void(const DataPointPath &, const MetaData &)> NotifyCallbackType
Definition repositorySubscriberIf.hpp:47
size_t SubscriptionId
Definition repositorySubscriberIf.hpp:50
RtctkException() noexcept
Definition exceptions.cpp:112
#define RTCTK_API
Helper to indicate that a class or function must be exported in the public symbol table.
Definition config.hpp:32
Definition commandReplier.cpp:21
std::uint64_t RtcUInt64
Definition basicTypes.hpp:44
Header file for RepositoryIf and related base classes.
Implementation file for RepositorySubscriberIf template methods and related classes.