RTC Toolkit
1.0.0
|
Abstract interface providing subscription facilities for a repository. More...
#include <repositorySubscriberIf.hpp>
Classes | |
class | SubscribeRequest |
A request object to pass information about datapoints to subscribe to. More... | |
class | UnsubscribeRequest |
A request object to pass information about datapoints to unsubscribe from. More... | |
Public Member Functions | |
virtual | ~RepositorySubscriberIf () |
virtual RepositoryIf::Response | SendSubscribeRequest (const SubscribeRequest &request) const =0 |
This is called to asynchronously send a subscription request for datapoints. More... | |
virtual RepositoryIf::Response | SendUnsubscribeRequest (const UnsubscribeRequest &request) const =0 |
This is called to asynchronously send a request to unsubscribe from various notifications. More... | |
template<typename T , typename F > | |
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 synchronous manner. More... | |
void | Unsubscribe (const DataPointPath &path) const |
A simple convenience function that will deregister all callbacks for receiving new datapoint values. More... | |
Abstract interface providing subscription facilities for a repository.
|
virtual |
|
pure virtual |
This is called to asynchronously send a subscription request for datapoints.
One or more datapoints can be subscribed to by constructing a SubscribeRequest object and sending it to the repository service with this method. A typical usage is indicated in the following code sample:
[in] | request | The subscription request to send to the repository. |
Implemented in rtctk::componentFramework::FileRuntimeRepoAdapter, rtctk::componentFramework::OldbAdapter, and rtctk::componentFramework::FileOldbAdapter.
|
pure virtual |
This is called to asynchronously send a request to unsubscribe from various notifications.
One can stop receiving notifications for one or more datapoints by constructing a UnsubscribeRequest object and sending it to the repository service with this method. A typical usage is indicated in the following code sample:
[in] | request | The request to send to the repository. |
Implemented in rtctk::componentFramework::FileRuntimeRepoAdapter, rtctk::componentFramework::OldbAdapter, and rtctk::componentFramework::FileOldbAdapter.
void rtctk::componentFramework::RepositorySubscriberIf::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 synchronous manner.
This function can be used for simple cases to register a callback function that will be called when a new datapoint value is received. The buffer will be filled with the new value before invoking the callback. For a large number of datapoints it is better to use the SendSubscribeRequest method.
[in] | path | The path of the datapoint to subscribe to. |
[in] | handler | A handler function, lambda or functional to invoke. It must have a signature compatible with void(const DataPointPath& path)
|
void rtctk::componentFramework::RepositorySubscriberIf::Unsubscribe | ( | const DataPointPath & | path | ) | const |
A simple convenience function that will deregister all callbacks for receiving new datapoint values.
This function can be used for simple cases to deregister all callback functions in a synchronous manner. For a large number of unsubscriptions it is better to use the SendUnsubscribeRequest method.
[in] | path | The path of the datapoint to unsubscribe from. |