Template Class ClientImpl

Inheritance Relationships

Base Types

Derived Type

Class Documentation

template<typename Req, typename Res, typename BaseClientT = BaseClient<>>
class ClientImpl : public iox::popo::BaseClient<>, private iox::popo::RpcInterface<Request<Req>, ClientSendError>

The ClientImpl class implements the typed client API.

Note

Not intended for public usage! Use the Client instead!

Subclassed by iox::popo::Client< Req, Res >

Public Functions

explicit ClientImpl(const capro::ServiceDescription &service, const ClientOptions &clientOptions = {}) noexcept

Constructor for a client.

Parameters:
  • service[in] is the ServiceDescription for the new client

  • clientOptions[in] like the queue capacity and queue full policy by a client

virtual ~ClientImpl() noexcept
ClientImpl(const ClientImpl&) = delete
ClientImpl(ClientImpl&&) = delete
ClientImpl &operator=(const ClientImpl&) = delete
ClientImpl &operator=(ClientImpl&&) = delete
template<typename ...Args>
cxx::expected<Request<Req>, AllocationError> loan(Args&&... args) noexcept

Get a Request from loaned shared memory and construct the data with the given arguments.

The loaned Request is automatically released when it goes out of scope.

Parameters:

args[in] Arguments used to construct the data.

Returns:

An instance of the Request that resides in shared memory or an error if unable to allocate memory to loan.

virtual cxx::expected<ClientSendError> send(Request<Req> &&request) noexcept override

Sends the given Request and then releases its loan.

Parameters:

request – to send.

Returns:

Error if sending was not successful

cxx::expected<Response<const Res>, ChunkReceiveResult> take() noexcept

Take the Response from the top of the receive queue.

The Response takes care of the cleanup. Don’t store the raw pointer to the content of the Response, but always the whole Response.

Returns:

Either a Response or a ChunkReceiveResult.