Skip to content

Service#

agnocast::Service<ServiceT>#

Agnocast service server. The callback signature is void(const ipc_shared_ptr&, ipc_shared_ptr&). The service/client API is experimental and may change in future versions.

Example:

using SrvT = example_interfaces::srv::AddTwoInts;
using RequestT = agnocast::Service<SrvT>::RequestT;
using ResponseT = agnocast::Service<SrvT>::ResponseT;

auto service = agnocast::create_service<SrvT>(
  this, "add_two_ints",
  [this](const agnocast::ipc_shared_ptr<RequestT> & req,
         agnocast::ipc_shared_ptr<ResponseT> & res) {
    res->sum = req->a + req->b;
  });