iceoryx_posh  2.0.2
untyped_client_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_CLIENT_IMPL_HPP
18 #define IOX_POSH_POPO_UNTYPED_CLIENT_IMPL_HPP
19 
20 #include "iceoryx_posh/capro/service_description.hpp"
21 #include "iceoryx_posh/internal/popo/base_client.hpp"
22 #include "iceoryx_posh/popo/client_options.hpp"
23 #include "iceoryx_posh/popo/trigger_handle.hpp"
24 #include "iceoryx_posh/runtime/posh_runtime.hpp"
25 
26 namespace iox
27 {
28 namespace popo
29 {
32 template <typename BaseClientT = BaseClient<>>
33 class UntypedClientImpl : public BaseClientT
34 {
35  public:
36  explicit UntypedClientImpl(const capro::ServiceDescription& service,
37  const ClientOptions& clientOptions = {}) noexcept;
38  virtual ~UntypedClientImpl() noexcept;
39 
40  UntypedClientImpl(const UntypedClientImpl&) = delete;
42  UntypedClientImpl& operator=(const UntypedClientImpl&) = delete;
43  UntypedClientImpl& operator=(UntypedClientImpl&&) = delete;
44 
51  cxx::expected<void*, AllocationError> loan(const uint32_t payloadSize, const uint32_t payloadAlignment) noexcept;
52 
58  void releaseRequest(void* const requestPayload) noexcept;
59 
63  cxx::expected<ClientSendError> send(void* const requestPayload) noexcept;
64 
69  cxx::expected<const void*, ChunkReceiveResult> take() noexcept;
70 
76  void releaseResponse(const void* const responsePayload) noexcept;
77 
78  protected:
79  using BaseClientT::port;
80 };
81 } // namespace popo
82 } // namespace iox
83 
84 #include "iceoryx_posh/internal/popo/untyped_client_impl.inl"
85 
86 #endif // IOX_POSH_POPO_UNTYPED_CLIENT_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
const accessor of the underlying port
The UntypedClientImpl class implements the untyped client API.
Definition: untyped_client_impl.hpp:34
void releaseRequest(void *const requestPayload) noexcept
Releases the ownership of the request chunk provided by the payload pointer.
cxx::expected< void *, AllocationError > loan(const uint32_t payloadSize, const uint32_t payloadAlignment) noexcept
Get a request chunk from loaned shared memory.
cxx::expected< ClientSendError > send(void *const requestPayload) noexcept
Sends the provided memory chunk as request to the server.
void releaseResponse(const void *const responsePayload) noexcept
Releases the ownership of the response chunk provided by the payload pointer.
cxx::expected< const void *, ChunkReceiveResult > take() noexcept
Take the response chunk from the top of the receive queue.
This struct is used to configure the client.
Definition: client_options.hpp:33