RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
rtctk::componentFramework::RepositoryIf::ReadRequest Class Reference

A request object to pass information about datapoints that should be read from the repository. More...

#include <rtctk/componentFramework/repositoryIf.hpp>

Classes

class  Parameters
 A structure to hold the arguments passed with one of the Add methods. More...
 

Public Member Functions

template<typename T >
void Add (const DataPointPath &path, T &buffer)
 Adds a datapoint to the request for reading.
 
template<typename T , typename F >
void Add (const DataPointPath &path, T &buffer, F handler)
 Adds a datapoint to the request for reading with a callback handler.
 
const std::vector< Parameters > & GetParams () const
 
std::vector< Parameters > & GetParams ()
 

Detailed Description

A request object to pass information about datapoints that should be read from the repository.

Thread Safety
thread-compatible
Deprecated
Use BatchRequest instead.

Member Function Documentation

◆ Add() [1/2]

template<typename T >
void rtctk::componentFramework::RepositoryIf::ReadRequest::Add ( const DataPointPath & path,
T & buffer )

Adds a datapoint to the request for reading.

Template Parameters
TThe type of the output buffer, which must match the type of the datapoint.
Parameters
[in]pathThe datapoint path from which to read from the repository.
[out]bufferThe local output buffer where the read datapoint should be stored in memory.
Thread Safety
thread-hostile – Intended to be used in one thread only.
Exception Safety
basic

◆ Add() [2/2]

template<typename T , typename F >
void rtctk::componentFramework::RepositoryIf::ReadRequest::Add ( const DataPointPath & path,
T & buffer,
F handler )

Adds a datapoint to the request for reading with a callback handler.

This method allows to add a request to read a datapoint and register a callback function that will be invoked as soon as the data arrives from the repository. The signature for the callback function must be as follows:

void handler(T& buffer);
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23

where T should be the same type as the type used for the buffer argument.

The callback function will typically execute in a different thread than the one that registered the handler in the first place.

Note
The callback function must not access any other datapoint buffers other than the buffer that it receives as an argument. This is the only buffer that is guaranteed to be delivered and ready at the time the callback is invoked.
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:
Parameters
[in]pathThe datapoint path from which to read from the repository.
[out]bufferThe local output buffer where the read datapoint should be stored in memory.
[in]handlerThe callback handler function to execute as soon as the data is received.
Thread Safety
thread-hostile – Intended to be used in one thread only.
Exception Safety
basic

◆ GetParams() [1/2]

std::vector< Parameters > & rtctk::componentFramework::RepositoryIf::ReadRequest::GetParams ( )
inline

◆ GetParams() [2/2]

const std::vector< Parameters > & rtctk::componentFramework::RepositoryIf::ReadRequest::GetParams ( ) const
inline

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