Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
52 const std::type_info& type,
53 const std::function<
void(
const DataPointPath& path)>& removed_callback,
54 const std::function<
void(
const DataPointPath& path)>& newvalue_callback)
79 template <
typename T,
typename F>
82 inline const std::vector<Parameters>&
GetParams()
const {
87 std::vector<Parameters> m_params;
112 const bool unsubscribe_removed,
113 const bool unsubscribe_newvalue)
157 inline const std::vector<Parameters>&
GetParams()
const {
162 std::vector<Parameters> m_params;
239 template <
typename T,
typename F>
278 template <
typename F>
281 m_params.push_back(
Parameters(path,
nullptr,
typeid(
void), handler,
nullptr));
308 template <
typename T,
typename F>
314 auto callback = [handler, &buffer](
const DataPointPath& path) ->
void {
315 handler(path, buffer);
317 m_params.push_back(
Parameters(path, &buffer,
typeid(buffer),
nullptr, callback));
338 template <
typename T,
typename F>
347 #endif // RTCTK_COMPONENTFRAMEWORK_REPOSITORYSUBSCRIBERIF_HPP
std::function< void(const DataPointPath &path)> m_newvalue_callback
Definition: repositorySubscriberIf.hpp:73
bool m_unsubscribe_newvalue
Indicates that we want to unsubscribe for new value notifications.
Definition: repositorySubscriberIf.hpp:126
A structure to hold the arguments passed with one of the Add methods.
Definition: repositorySubscriberIf.hpp:100
Parameters(const DataPointPath &path, const bool unsubscribe_removed, const bool unsubscribe_newvalue)
Allows to explicitly construct a complete parameters structure.
Definition: repositorySubscriberIf.hpp:111
virtual RepositoryIf::Response SendSubscribeRequest(const SubscribeRequest &request) const =0
This is called to asynchronously send a subscription request for datapoints.
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:309
const std::vector< Parameters > & GetParams() const
Definition: repositorySubscriberIf.hpp:157
virtual ~RepositorySubscriberIf()
Definition: repositorySubscriberIf.cpp:16
std::function< void(const DataPointPath &path)> m_removed_callback
The callback functions to invoke when a datapoint is removed or updated.
Definition: repositorySubscriberIf.hpp:72
Definition: commandReplier.cpp:20
const std::type_info & m_type
This stores the type information for the buffer.
Definition: repositorySubscriberIf.hpp:69
A request object to pass information about datapoints to subscribe to.
Definition: repositorySubscriberIf.hpp:31
Parameters(const DataPointPath &path, void *buffer, const std::type_info &type, const std::function< void(const DataPointPath &path)> &removed_callback, const std::function< void(const DataPointPath &path)> &newvalue_callback)
Allows to explicitly construct a complete parameters structure.
Definition: repositorySubscriberIf.hpp:49
Header file for RepositoryIf and related base classes.
A structure to hold the arguments passed to the Add method.
Definition: repositorySubscriberIf.hpp:36
A request object to pass information about datapoints to unsubscribe from.
Definition: repositorySubscriberIf.hpp:95
DataPointPath m_path
The datapoint path to subscribe to.
Definition: repositorySubscriberIf.hpp:63
void Wait()
Waits for the request sent to the repository to complete.
Definition: repositoryIf.cpp:30
bool m_unsubscribe_removed
Indicates that we want to unsubscribe for datapoint removal notifications.
Definition: repositorySubscriberIf.hpp:123
void AddRemovedHandler(const DataPointPath &path, F handler)
Adds a request to subscribe to removal notifications for a particular datapoint.
Definition: repositorySubscriberIf.hpp:279
void * m_buffer
The buffer of data that will be filled with new values.
Definition: repositorySubscriberIf.hpp:66
const std::vector< Parameters > & GetParams() const
Definition: repositorySubscriberIf.hpp:82
This class provides a wraper for DataPoint paths which ensures that they only contain valid character...
Definition: dataPointPath.hpp:34
DataPointPath m_path
The datapoint path to unsubscribe from.
Definition: repositorySubscriberIf.hpp:120
An object used to wait for a request to complete.
Definition: repositoryIf.hpp:106
virtual RepositoryIf::Response SendUnsubscribeRequest(const UnsubscribeRequest &request) const =0
This is called to asynchronously send a request to unsubscribe from various notifications.
Abstract interface providing subscription facilities for a repository.
Definition: repositorySubscriberIf.hpp:24
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:339