RTI Connext Modern C++ API
Version 5.3.1
|
<<reference-type>> A callback-based replier More...
#include <rti/request/SimpleReplier.hpp>
Inherits dds::core::Reference< DELEGATE >.
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. | |
Public Member Functions inherited from dds::core::Reference< DELEGATE > | |
Reference (dds::core::null_type &) | |
Reference (const Reference &ref) | |
template<typename D > | |
Reference (const Reference< D > &ref) | |
~Reference () | |
template<typename R > | |
bool | operator== (const R &ref) const |
template<typename R > | |
bool | operator!= (const R &ref) const |
Reference & | operator= (const null_type) |
bool | is_nil () const |
bool | operator== (const null_type) const |
bool | operator!= (const null_type) const |
const DELEGATE_REF_T & | delegate () const OMG_NOEXCEPT |
DELEGATE_REF_T & | delegate () OMG_NOEXCEPT |
DELEGATE * | operator-> () OMG_NOEXCEPT |
const DELEGATE * | operator-> () const OMG_NOEXCEPT |
<<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 |