RTI Connext Modern C++ API
Version 6.0.1
|
<<reference-type>> A callback-based replier More...
#include <rti/request/SimpleReplier.hpp>
Public Member Functions | |
template<typename Functor > | |
SimpleReplier (dds::domain::DomainParticipant participant, const std::string &service_name, Functor request_handler) | |
Creates a SimpleReplier. | |
template<typename Functor > | |
SimpleReplier (const ReplierParams ¶ms, Functor request_handler) | |
Creates a SimpleReplier with additional parameters. | |
<<reference-type>> A callback-based replier
A SimpleReplier is based on a callback functor. Requests are passed to the callback, which returns a reply. The reply is directed only to the Requester that sent the request.
SimpleRepliers are useful for simple use cases where a single reply for a request can be generated quickly, for example, looking up a table.
When more than one reply for a request can be generated or the processing is complex or needs to happen asynchronously, use a rti::request::Replier instead.
In the following example, the SimpleReplier responds to requests consisting of the built-in type dds::core::StringTopicType with another string that prepends "Hello" to the request.
|
inline |
Creates a SimpleReplier.
Functor | A function or function object that can receive a single parameter const RequestType& and returns a ReplyType instance by value. |
participant | The DomainParticipant that the Replier uses to join a domain. |
service_name | The service name. See ReplierParams::service_name |
request_handler | A functor that receives a request and returns a reply |
|
inline |
Creates a SimpleReplier with additional parameters.
Functor | A function or function object that can receive a single parameter const RequestType& and returns a ReplyType instance by value. |
params | The parameters used to configure the replier |
request_handler | A functor that receives a request and returns a reply |