Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
55 const std::type_info&
type,
56 const std::function<
void(
const DataPointPath&)>& removed_callback,
57 const std::function<
void(
const DataPointPath&)>& newvalue_callback)
61 , m_removed_callback(removed_callback)
62 , m_newvalue_callback(newvalue_callback) {
71 inline const std::type_info&
GetType()
const {
75 return m_removed_callback;
78 return m_newvalue_callback;
89 const std::type_info* m_type;
93 std::function<void(
const DataPointPath&)> m_newvalue_callback;
99 template <
typename T,
typename F>
102 inline const std::vector<Parameters>&
GetParams()
const {
107 std::vector<Parameters> m_params;
133 const bool unsubscribe_removed,
134 const bool unsubscribe_newvalue)
136 , m_unsubscribe_removed(unsubscribe_removed)
137 , m_unsubscribe_newvalue(unsubscribe_newvalue) {
144 return m_unsubscribe_removed;
147 return m_unsubscribe_newvalue;
155 bool m_unsubscribe_removed;
158 bool m_unsubscribe_newvalue;
189 inline const std::vector<Parameters>&
GetParams()
const {
194 std::vector<Parameters> m_params;
271 template <
typename T,
typename F>
295 std::any m_extra_objects;
316 template <
typename F>
319 m_params.push_back(
Parameters(path,
nullptr,
typeid(
void), handler,
nullptr));
346 template <
typename T,
typename F>
352 auto callback = [handler, &buffer](
const DataPointPath& path) ->
void {
353 handler(path, buffer);
355 m_params.push_back(
Parameters(path, &buffer,
typeid(buffer),
nullptr, callback));
376 template <
typename T,
typename F>
385 #endif // RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
const DataPointPath & GetPath() const
Definition: repositorySubscriberIf.hpp:140
const std::function< void(const DataPointPath &)> & GetRemovedCallback() const
Definition: repositorySubscriberIf.hpp:74
virtual RepositoryIf::Response SendSubscribeRequest(const SubscribeRequest &request) const =0
This is called to asynchronously send a subscription request for datapoints.
const std::function< void(const DataPointPath &)> & GetNewValueCallback() const
Definition: repositorySubscriberIf.hpp:77
void AddRemovedHandler(const DataPointPath &path)
Adds a request to unsubscribe from removal notifications.
Definition: repositorySubscriberIf.cpp:19
void AddNewValueHandler(const DataPointPath &path, T &buffer, F handler)
Adds a request to subscribe to new data values for a particular datapoint.
Definition: repositorySubscriberIf.hpp:347
const std::vector< Parameters > & GetParams() const
Definition: repositorySubscriberIf.hpp:189
virtual ~RepositorySubscriberIf()
Definition: repositorySubscriberIf.cpp:16
const std::type_info & GetType() const
Definition: repositorySubscriberIf.hpp:71
A structure to hold the arguments passed with one of the Add methods.
Definition: repositorySubscriberIf.hpp:120
Definition: commandReplier.cpp:20
A request object to pass information about datapoints to subscribe to.
Definition: repositorySubscriberIf.hpp:33
bool GetUnsubscribeRemoved() const
Definition: repositorySubscriberIf.hpp:143
void * GetBuffer() const
Definition: repositorySubscriberIf.hpp:68
Header file for RepositoryIf and related base classes.
A request object to pass information about datapoints to unsubscribe from.
Definition: repositorySubscriberIf.hpp:115
void Wait()
Waits for the request that was sent to the repository to complete.
Definition: repositoryIf.cpp:31
void AddRemovedHandler(const DataPointPath &path, F handler)
Adds a request to subscribe to removal notifications for a particular datapoint.
Definition: repositorySubscriberIf.hpp:317
bool GetUnsubscribeNewValue() const
Definition: repositorySubscriberIf.hpp:146
const DataPointPath & GetPath() const
Definition: repositorySubscriberIf.hpp:65
Parameters(const DataPointPath &path, const bool unsubscribe_removed, const bool unsubscribe_newvalue)
Allows to explicitly construct a complete parameters structure.
Definition: repositorySubscriberIf.hpp:132
const std::vector< Parameters > & GetParams() const
Definition: repositorySubscriberIf.hpp:102
This class provides a wrapper for a data point path.
Definition: dataPointPath.hpp:65
An object used to wait for a request to complete.
Definition: repositoryIf.hpp:188
virtual RepositoryIf::Response SendUnsubscribeRequest(const UnsubscribeRequest &request) const =0
This is called to asynchronously send a request to unsubscribe from various notifications.
A structure to hold the arguments passed to the Add method.
Definition: repositorySubscriberIf.hpp:38
Abstract interface providing subscription facilities for a repository.
Definition: repositorySubscriberIf.hpp:26
Parameters(const DataPointPath &path, void *buffer, const std::type_info &type, const std::function< void(const DataPointPath &)> &removed_callback, const std::function< void(const DataPointPath &)> &newvalue_callback)
Allows to explicitly construct a complete parameters structure.
Definition: repositorySubscriberIf.hpp:52
friend class PyRepositorySubscriberIf
Definition: repositorySubscriberIf.hpp:294
void AddNewValueHandler(const DataPointPath &path)
Adds a request to unsubscribe from new value notifications for a datapoint.
Definition: repositorySubscriberIf.cpp:23
void Unsubscribe(const DataPointPath &path) const
A simple convenience function that will deregister all callbacks for receiving new datapoint values.
Definition: repositorySubscriberIf.cpp:27
void Subscribe(const DataPointPath &path, T &buffer, F handler) const
A convenience template function that will register a callback to receive new datapoint values in a sy...
Definition: repositorySubscriberIf.hpp:377