RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
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 <rtctk/componentFramework/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.
 
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.
 
template<typename F >
void AddValueChangedHandler (const DataPointPath &path, F handler)
 Adds a request to subscribe to value change notifications for a particular datapoint.
 
const std::vector< Parameters > & GetParams () const
 

Detailed Description

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

Thread Safety
thread-compatible
Deprecated
Use BatchRequest instead.

Member Function Documentation

◆ AddNewValueHandler()

template<typename T , typename F >
void rtctk::componentFramework::RepositorySubscriberIf::SubscribeRequest::AddNewValueHandler ( const DataPointPath & path,
T & buffer,
F 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.
Template Parameters
TThe type of the output buffer, which must match the type of the datapoint.
FThe type of the handler callback function. It can be any callable that has a function signature compatible with:
void(const DataPointPath& path, T& buffer)
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:74
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
Parameters
[in]pathThe path of the datapoint to subscribe to.
[out]bufferThe buffer that will be filled with new data values.
[in]handlerA handler function, lambda or functional to invoke after a new datapoint value is received.
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,
F 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.

Template Parameters
FThe type of the handler callback function. It can be any callable that has a function signature compatible with:
void(const DataPointPath& path)
Parameters
[in]pathThe path of the datapoint to subscribe to.
[in]handlerA handler function, lambda or functional to invoke after the datapoint has been deleted.
Thread Safety
thread-hostile – Intended to be used in one thread only.
Exception Safety
basic

◆ AddValueChangedHandler()

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

Adds a request to subscribe to value change notifications 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 the given d atapoint 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 notification is received the callback handler function is invoked.

Template Parameters
FThe type of the handler callback function. It can be any callable that has a function signature compatible with:
void(const DataPointPath& path)
Parameters
[in]pathThe path of the datapoint to subscribe to.
[in]handlerA handler function, lambda or functional to invoke after a new datapoint value is received.
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 files: