iceoryx_posh 2.0.3
untyped_server_impl.hpp
1// Copyright (c) 2022 by Apex.AI Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// SPDX-License-Identifier: Apache-2.0
16
17#ifndef IOX_POSH_POPO_UNTYPED_SERVER_IMPL_HPP
18#define IOX_POSH_POPO_UNTYPED_SERVER_IMPL_HPP
19
20#include "iceoryx_posh/capro/service_description.hpp"
21#include "iceoryx_posh/internal/popo/base_server.hpp"
22#include "iceoryx_posh/popo/server_options.hpp"
23
24namespace iox
25{
26namespace popo
27{
30template <typename BaseServerT = BaseServer<>>
31class UntypedServerImpl : public BaseServerT
32{
33 public:
34 explicit UntypedServerImpl(const capro::ServiceDescription& service,
35 const ServerOptions& serverOptions = {}) noexcept;
36 virtual ~UntypedServerImpl() noexcept;
37
38 UntypedServerImpl(const UntypedServerImpl&) = delete;
40 UntypedServerImpl& operator=(const UntypedServerImpl&) = delete;
41 UntypedServerImpl& operator=(UntypedServerImpl&&) = delete;
42
47 cxx::expected<const void*, ServerRequestResult> take() noexcept;
48
54 void releaseRequest(const void* const requestPayload) noexcept;
55
64 cxx::expected<void*, AllocationError> loan(const RequestHeader* const requestHeader,
65 const uint32_t payloadSize,
66 const uint32_t payloadAlignment) noexcept;
67
71 cxx::expected<ServerSendError> send(void* const responsePayload) noexcept;
72
78 void releaseResponse(void* const responsePayload) noexcept;
79
80 protected:
81 using BaseServerT::port;
82};
83} // namespace popo
84} // namespace iox
85
86#include "iceoryx_posh/internal/popo/untyped_server_impl.inl"
87
88#endif // IOX_POSH_POPO_UNTYPED_SERVER_IMPL_HPP
class for the identification of a communication event including information on the service,...
Definition: service_description.hpp:81
const PortT & port() const noexcept
port
Definition: rpc_header.hpp:94
The UntypedServerImpl class implements the untyped server API.
Definition: untyped_server_impl.hpp:32
void releaseResponse(void *const responsePayload) noexcept
Releases the ownership of the response chunk provided by the payload pointer.
void releaseRequest(const void *const requestPayload) noexcept
Releases the ownership of the request chunk provided by the payload pointer.
cxx::expected< const void *, ServerRequestResult > take() noexcept
Take the request chunk from the top of the receive queue.
cxx::expected< void *, AllocationError > loan(const RequestHeader *const requestHeader, const uint32_t payloadSize, const uint32_t payloadAlignment) noexcept
Get a response chunk from loaned shared memory.
cxx::expected< ServerSendError > send(void *const responsePayload) noexcept
Sends the provided memory chunk as response to the client.
This struct is used to configure the server.
Definition: server_options.hpp:33