Template Class ServerImpl

Inheritance Relationships

Base Types

Derived Type

Class Documentation

template<typename Req, typename Res, typename BaseServerT = BaseServer<>>
class ServerImpl : public iox::popo::BaseServer<>, private iox::popo::RpcInterface<Response<Res>, ServerSendError>

The ServerImpl class implements the typed server API.

Note

Not intended for public usage! Use the Server instead!

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

Public Functions

explicit ServerImpl(const capro::ServiceDescription &service, const ServerOptions &serverOptions = {}) noexcept

Constructor for a sserver.

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

  • serverOptions[in] like the queue capacity and queue full policy by a server

virtual ~ServerImpl() noexcept
ServerImpl(const ServerImpl&) = delete
ServerImpl(ServerImpl&&) = delete
ServerImpl &operator=(const ServerImpl&) = delete
ServerImpl &operator=(ServerImpl&&) = delete
cxx::expected<Request<const Req>, ServerRequestResult> take() noexcept

Take the Request from the top of the receive queue.

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

Returns:

Either a Request or a ServerRequestResult.

template<typename ...Args>
cxx::expected<Response<Res>, AllocationError> loan(const Request<const Req> &request, Args&&... args) noexcept

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

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

Parameters:
  • request[in] The request to which the Response belongs to, to determine where to send the response

  • args[in] Arguments used to construct the data.

Returns:

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

virtual cxx::expected<ServerSendError> send(Response<Res> &&response) noexcept override

Sends the given Response and then releases its loan.

Parameters:

response – to send.

Returns:

Error if sending was not successful