RTI Connext Modern C++ API
Version 5.3.1
|
<<reference-type>> Allows receiving requests and sending replies More...
#include <rti/request/Replier.hpp>
Inherits dds::core::Reference< DELEGATE >.
Public Member Functions | |
Replier (dds::domain::DomainParticipant participant, const std::string &service_name) | |
Creates a Replier with the minimum set of parameters. | |
Replier (const ReplierParams ¶ms) | |
Creates a Replier with parameters. | |
Replier (const ReplierParams ¶ms, Listener *the_listener) | |
Creates a replier with additional parameters and a listener. | |
void | send_reply (const ReplyType &reply, const rti::core::SampleIdentity &related_request_id) |
Sends a reply for a previous request. | |
void | send_reply (const ReplyType &reply, const dds::sub::SampleInfo &related_request_info) |
Sends a reply. | |
void | send_reply (const ReplyType &reply, rti::pub::WriteParams ¶ms) |
Sends a reply with advanced parameters. | |
bool | wait_for_requests (const dds::core::Duration &max_wait) |
Waits for requests. | |
bool | wait_for_requests (int min_count, const dds::core::Duration &max_wait) |
Waits for requests. | |
dds::sub::LoanedSamples < RequestType > | receive_requests (const dds::core::Duration &max_wait) |
Waits for multiple requests and provides a loaned container to access them. | |
dds::sub::LoanedSamples < RequestType > | receive_requests (int min_count, const dds::core::Duration &max_wait) |
Waits for multiple requests and provides a loaned container to access them. | |
dds::sub::LoanedSamples < RequestType > | take_requests () |
Takes all the requests. | |
dds::sub::LoanedSamples < RequestType > | read_requests () |
Reads all the requests. | |
Listener * | listener () const |
Sets a ReplierListener. | |
void | listener (Listener *the_listener, const dds::core::status::StatusMask &=dds::core::status::StatusMask::none()) |
Sets a ReplierListener. | |
dds::sub::DataReader< RequestType > | request_datareader () const |
Retrieves the underlying dds::sub::DataReader. | |
dds::pub::DataWriter< ReplyType > | reply_datawriter () const |
Retrieves the underlying dds::pub::DataWriter. | |
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>> Allows receiving requests and sending replies
A Replier is an entity with two associated topics: a request topic and a reply topic. It can receive requests by subscribing to the request topic and can send replies to those requests by publishing the reply topic.
Valid types for these topics are: those generated by the rtiddsgen code generator, the DDS built-in types, and dds::core::xtypes::DynamicData. See Creating a Replier.
A Replier has four main types of operations:
For multi-reply scenarios in which a rti::request::Replier generates more than one reply for a request, the rti::request::Replier should mark all the intermediate replies (all but the last) using the rti::core::SampleFlag::intermediate_reply_sequence flag in rti::pub::WriteParams::flag.
Much like a Requester, a Replier has an associated dds::domain::DomainParticipant, which can be shared with other Repliers or RTI Connext routines. All the other entities required for the request-reply interaction, including a dds::pub::DataWriter for writing replies and a dds::sub::DataReader for reading requests, are automatically created when the Replier is constructed.
Quality of Service for the underlying DataWriter and DataReader can be configured (see RequesterParams::qos_profile). By default, they are created with dds::core::policy::ReliabilityKind::RELIABLE. The exact default configuration is described here: Configuring Request-Reply QoS profiles
There are several ways to use a Replier:
RequestType | The data type for the request topic |
ReplyType | The data type for the reply topic |
|
inline |
Creates a Replier with the minimum set of parameters.
participant | The DomainParticipant that this Replier uses to join a domain. |
service_name | The service name. See ReplierParams::service_name |
One | of the Standard Exceptions |
|
inlineexplicit |
Creates a Replier with parameters.
params | All the parameters that configure this Replier |
One | of the Standard Exceptions |
|
inline |
Creates a replier with additional parameters and a listener.
the_listener | A ReplierListener that notifies when new requests are available. Cannot be NULL. |
this->listener(NULL)
before this object can be destroyed. Alternatively, create the Replier and then use rti::core::bind_listener() to have it automatically reset.
|
inline |
Sends a reply for a previous request.
The related request identity can be retrieved from an existing request sample (Sample).
reply | The reply to be sent. |
related_request_id | The identity of a previously received request |
One | of the Standard Exceptions |
|
inline |
Sends a reply.
This operation obtains the related_request_id from a request SampleInfo, that is, it's equivalent to send_reply(reply, related_request_info->original_publication_virtual_sample_identity())
|
inline |
Sends a reply with advanced parameters.
reply | The reply to be sent |
params | (in-out) The parameters to write the reply (see ). |
Other parameters to customize are discussed in dds::pub::DataWriter::write(const T&,rti::pub::WriteParams&). In particular, rti::pub::WriteParams::flag can be set to rti::core::SampleFlag::intermediate_reply_sequence to inform the Requester application that this reply will be followed by additional replies to the same request. The Requester can access the flag in dds::sub::SampleInfo::flag() when it receives the reply.
|
inline |
Waits for requests.
Equivalent to rti::request::Replier::wait_for_requests with min_count=1
|
inline |
Waits for requests.
This operation waits for min_count requests to be available. It will wait up to max_wait .
This operation is similar to rti::request::Requester::wait_for_replies(int, const dds::core::Duration&).
min_count | Minimum number of requests that need to be available for this operation to unblock. |
max_wait | Maximum waiting time after which this operation unblocks regardless of how many requests are available. |
|
inline |
Waits for multiple requests and provides a loaned container to access them.
Equivalent to using rti::request::Replier::receive_requests with min_count=1
and max_count=dds::core::LENGTH_UNLIMITED
|
inline |
Waits for multiple requests and provides a loaned container to access them.
Equivalent to using rti::request::Replier::wait_for_requests and rti::request::Replier::take_requests
|
inline |
Takes all the requests.
|
inline |
Reads all the requests.
This operation is equivalent to rti::request::Replier::take_requests except the requests remain in the Replier and can be read or taken again.
|
inline |
Sets a ReplierListener.
The listener will be called when new requests are available
|
inline |
Sets a ReplierListener.
The listener will be called when new requests are available.
(The second parameter is ignored)
|
inline |
Retrieves the underlying dds::sub::DataReader.
|
inline |
Retrieves the underlying dds::pub::DataWriter.