RTC Toolkit 6.0.0-pre2
Loading...
Searching...
No Matches
repositorySubscriberIf.hpp
Go to the documentation of this file.
1
12
13#ifndef RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
14#define RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
15
17
19
28public:
29 // TODO: flesh out the details of this error type
30 // this likely will map to follwoing dds reader callbacks:
31 // - on sample_rejected
32 // - on_sample_lost
33 // - on_request_deadline_missed
34 // - on request_incompatible_qos
36 public:
38 };
39
41 public:
42 SequenceIdMissmatch(const DataPointPath& path, RtcUInt64 expected, RtcUInt64 actual);
43 };
44
45 template <typename T>
46 using ValueCallbackType = std::function<void(const DataPointPath&, T&, const MetaData&)>;
47
48 using NotifyCallbackType = std::function<void(const DataPointPath&, const MetaData&)>;
49 using ErrorCallbackType = std::function<void(std::exception_ptr)>;
50
51 using SubscriptionId = size_t;
52
64 class RTCTK_API Subscription final {
65 public:
66 using UnsubscribeMethod = std::function<void()>;
67
70
71 Subscription(const Subscription&) = delete;
73
74 Subscription(Subscription&&) noexcept;
75 Subscription& operator=(Subscription&&) noexcept;
76
77 void Unsubscribe();
78
79 private:
80 UnsubscribeMethod m_unsubscribe;
81 };
82
91
93
124 template <typename T = void, typename F>
126 const F& cb_value,
127 const ErrorCallbackType& cb_error) const;
128
146 Subscription Subscribe(const CallbackType& cb_created,
147 const CallbackType& cb_deleted,
148 const ErrorCallbackType& cb_error) const;
149};
150
151} // namespace rtctk::componentFramework
152
154
155#endif // RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:77
friend RepositoryIf
Definition repositoryIf.hpp:921
Class for passing/receiving metadata to/from the repository.
Definition repositoryIf.hpp:146
std::function< void(const DataPointPath &)> CallbackType
Signature of the callback functions that can be registered with the repository requests.
Definition repositoryIf.hpp:61
void Unsubscribe(SubscriptionId) const
Definition repositorySubscriberIf.cpp:53
SubscriptionId Subscribe(const DataPointPath &, NotifyCallbackType, ErrorCallbackType) const
Definition repositorySubscriberIf.cpp:30
SequenceIdMissmatch(const DataPointPath &path, RtcUInt64 expected, RtcUInt64 actual)
Definition repositorySubscriberIf.cpp:18
RAII wrapper class used to manage the life-time of individual subscriptions.
Definition repositorySubscriberIf.hpp:64
std::function< void()> UnsubscribeMethod
Definition repositorySubscriberIf.hpp:66
void Unsubscribe()
Definition repositorySubscriberIf.cpp:86
Subscription(UnsubscribeMethod)
Definition repositorySubscriberIf.cpp:57
Subscription & operator=(const Subscription &)=delete
std::function< void(std::exception_ptr)> ErrorCallbackType
Definition repositorySubscriberIf.hpp:49
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:49
std::function< void(const DataPointPath &, T &, const MetaData &)> ValueCallbackType
Definition repositorySubscriberIf.hpp:46
std::function< void(const DataPointPath &, const MetaData &)> NotifyCallbackType
Definition repositorySubscriberIf.hpp:48
size_t SubscriptionId
Definition repositorySubscriberIf.hpp:51
RtctkException() noexcept
Definition exceptions.cpp:113
#define RTCTK_API
Helper to indicate that a class or function must be exported in the public symbol table.
Definition config.hpp:33
Definition commandReplier.cpp:22
std::uint64_t RtcUInt64
Definition basicTypes.hpp:45
Header file for RepositoryIf and related base classes.
Implementation file for RepositorySubscriberIf template methods and related classes.