20.1.7.3. Requester

class Requester : public eprosima::fastdds::dds::rpc::RPCEntity

Base class for a Requester in the RPC communication.

Public Functions

virtual const std::string &get_service_name() const = 0

Returns the name of the service to which the requester belongs.

virtual ReturnCode_t send_request(void *data, RequestInfo &info) = 0

Send a request message.

Parameters:
  • data – Data to send

  • info – Information about the request sample. This information is used to match the request with the reply through the SampleIdentity

Returns:

RETCODE_OK if the reply was sent successfully or a ReturnCode related to the specific error otherwise

virtual ReturnCode_t take_reply(void *data, RequestInfo &info) = 0

Take a reply message from the Requester DataReader’s history.

Parameters:
  • data – Data to receive the reply

  • info – Information about the reply sample

Returns:

RETCODE_OK if the reply was taken successfully or a ReturnCode related to the specific error otherwise

virtual ReturnCode_t take_reply(LoanableCollection &data, LoanableSequence<RequestInfo> &info) = 0

Take all reply messages stored in the Requester DataReader’s history.

Note

This method does not allow to take only the samples associated to a given request. User must implement a zero-copy solution to link request and reply samples.

Parameters:
  • data – Data to receive the replies

  • info – Information about the reply samples

Returns:

RETCODE_OK if the replies were taken successfully or a ReturnCode related to the specific error otherwise

virtual ReturnCode_t return_loan(LoanableCollection &data, LoanableSequence<RequestInfo> &info) = 0

This operation indicates to the Requester’s DataReader that the application is done accessing the collection of Reply datas and infos obtained by some earlier invocation of take_reply.

Parameters:
  • data[inout] A LoanableCollection object where the received data samples were obtained from an earlier invocation of take_reply on this Requester.

  • info[inout] A LoanableSequence where the received request infos were obtained from an earlier invocation of take_reply on this Requester.

virtual DataWriter *get_requester_writer() const = 0

Getter for the Requester’s DataWriter.

virtual DataReader *get_requester_reader() const = 0

Getter for the Requester’s DataReader.