iceoryx_doc  1.0.1
untyped_publisher.hpp
1 // Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2 // Copyright (c) 2020 - 2021 by Apex.AI Inc. All rights reserved.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 // SPDX-License-Identifier: Apache-2.0
17 
18 #ifndef IOX_POSH_POPO_UNTYPED_PUBLISHER_HPP
19 #define IOX_POSH_POPO_UNTYPED_PUBLISHER_HPP
20 
21 #include "iceoryx_posh/popo/base_publisher.hpp"
22 #include "iceoryx_posh/popo/sample.hpp"
23 
24 namespace iox
25 {
26 namespace popo
27 {
28 template <typename BasePublisher_t = BasePublisher<>>
29 class UntypedPublisherImpl : public BasePublisher_t
30 {
31  public:
33  const PublisherOptions& publisherOptions = PublisherOptions());
34  UntypedPublisherImpl(const UntypedPublisherImpl& other) = delete;
35  UntypedPublisherImpl& operator=(const UntypedPublisherImpl&) = delete;
37  UntypedPublisherImpl& operator=(UntypedPublisherImpl&& rhs) = default;
38  virtual ~UntypedPublisherImpl() = default;
39 
48  cxx::expected<void*, AllocationError>
49  loan(const uint32_t userPayloadSize,
50  const uint32_t userPayloadAlignment = iox::CHUNK_DEFAULT_USER_PAYLOAD_ALIGNMENT,
51  const uint32_t userHeaderSize = iox::CHUNK_NO_USER_HEADER_SIZE,
52  const uint32_t userHeaderAlignment = iox::CHUNK_NO_USER_HEADER_ALIGNMENT) noexcept;
53 
59  void publish(void* const userPayload) noexcept;
60 
68  void release(void* const userPayload) noexcept;
69 
70  protected:
71  using BasePublisher_t::port;
72 };
73 
75 
76 } // namespace popo
77 } // namespace iox
78 
79 #include "iceoryx_posh/internal/popo/untyped_publisher.inl"
80 
81 #endif // IOX_POSH_POPO_UNTYPED_PUBLISHER_HPP
class for the identification of a communication event including information on the service,...
Definition: service_description.hpp:86
Definition: untyped_publisher.hpp:30
void release(void *const userPayload) noexcept
Releases the ownership of the chunk provided by the user-payload pointer.
Definition: untyped_publisher.inl:58
void publish(void *const userPayload) noexcept
Publish the provided memory chunk.
Definition: untyped_publisher.inl:33
cxx::expected< void *, AllocationError > loan(const uint32_t userPayloadSize, const uint32_t userPayloadAlignment=iox::CHUNK_DEFAULT_USER_PAYLOAD_ALIGNMENT, const uint32_t userHeaderSize=iox::CHUNK_NO_USER_HEADER_SIZE, const uint32_t userHeaderAlignment=iox::CHUNK_NO_USER_HEADER_ALIGNMENT) noexcept
Get a chunk from loaned shared memory.
Definition: untyped_publisher.inl:41
Definition: service_description.hpp:29
This struct is used to configure the publisher.
Definition: publisher_options.hpp:30