RTC Toolkit  2.0.0
Classes | Public Member Functions | List of all members
rtctk::componentFramework::RepositorySubscriberIf::SubscribeRequest Class Reference

A request object to pass information about datapoints to subscribe to. More...

#include <repositorySubscriberIf.hpp>

Classes

class  Parameters
 A structure to hold the arguments passed to the Add method. More...
 

Public Member Functions

template<typename F >
void AddRemovedHandler (const DataPointPath &path, F handler)
 Adds a request to subscribe to removal notifications for a particular datapoint. More...
 
template<typename T , typename F >
void AddNewValueHandler (const DataPointPath &path, T &buffer, F handler)
 Adds a request to subscribe to new data values for a particular datapoint. More...
 
const std::vector< Parameters > & GetParams () const
 

Detailed Description

A request object to pass information about datapoints to subscribe to.

Thread Safety
thread-compatible

Member Function Documentation

◆ AddNewValueHandler()

template<typename T , typename F >
void rtctk::componentFramework::RepositorySubscriberIf::SubscribeRequest::AddNewValueHandler ( const DataPointPath path,
T &  buffer,
handler 
)

Adds a request to subscribe to new data values for a particular datapoint.

This will associate a particular callback function to receive new datapoint values. Once the request has been sent with the SendSubscribeRequest method, notifications for new data values for the given datapoint will be received as soon as the registration completes. This may occur before the Response::Wait returns, i.e. the response object returned by SendSubscribeRequest. Whenever a new data value notification is received the callback handler function is invoked. It takes two arguments, the path of the datapoint that was updated and a reference to the registered buffer that contains the updated value.

Note
The buffer that is given to this method must only be accessed inside the callback function since it is executed on a different thread than the caller. Alternatively, one can use standard synchronisation mechanisms, e.g. a mutex, to avoid race conditions.
Parameters
[in]pathThe path of the datapoint to subscribe to.
[in]bufferThe buffer that will be filled with new data values.
[in]handlerA handler function, lambda or functional to invoke. It must have a signature compatible with
void(const DataPointPath& path, T& buffer)
.
Thread Safety
thread-hostile❗ – Intended to be used in one thread only.
Exception Safety
basic

◆ AddRemovedHandler()

template<typename F >
void rtctk::componentFramework::RepositorySubscriberIf::SubscribeRequest::AddRemovedHandler ( const DataPointPath path,
handler 
)

Adds a request to subscribe to removal notifications for a particular datapoint.

This will associate a particular notification callback function with a datapoint. Once the request has been sent with the SendSubscribeRequest method, notifications for removed datapoints will be received as soon as registration completes and the datapoint has actually been removed. This may occur before the Responce::Wait returns, i.e. the response object returned by SendSubscribeRequest. Whenever a notification is received the given handler callback function is invoked. Its argument will contain the path of the datapoint that was removed.

Parameters
[in]pathThe path of the datapoint to subscribe to.
[in]handlerA handler function, lambda or functional to invoke. It must have a signature compatible with
void(const DataPointPath& path)
.
Thread Safety
thread-hostile❗ – Intended to be used in one thread only.
Exception Safety
basic

◆ GetParams()

const std::vector<Parameters>& rtctk::componentFramework::RepositorySubscriberIf::SubscribeRequest::GetParams ( ) const
inline

The documentation for this class was generated from the following file: