Skip to content

iceoryx_posh/internal/popo/untyped_publisher_impl.hpp🔗

Namespaces🔗

Name
iox
iox::popo

Classes🔗

Name
class iox::popo::UntypedPublisherImpl
The UntypedPublisherImpl class implements the untyped publisher API.

Source code🔗

// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2020 - 2022 by Apex.AI Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0

#ifndef IOX_POSH_POPO_UNTYPED_PUBLISHER_IMPL_HPP
#define IOX_POSH_POPO_UNTYPED_PUBLISHER_IMPL_HPP

#include "iceoryx_posh/internal/popo/base_publisher.hpp"
#include "iceoryx_posh/popo/sample.hpp"

namespace iox
{
namespace popo
{
template <typename BasePublisherType = BasePublisher<>>
class UntypedPublisherImpl : public BasePublisherType
{
  public:
    explicit UntypedPublisherImpl(const capro::ServiceDescription& service,
                                  const PublisherOptions& publisherOptions = PublisherOptions());
    UntypedPublisherImpl(const UntypedPublisherImpl& other) = delete;
    UntypedPublisherImpl& operator=(const UntypedPublisherImpl&) = delete;
    UntypedPublisherImpl(UntypedPublisherImpl&& rhs) = delete;
    UntypedPublisherImpl& operator=(UntypedPublisherImpl&& rhs) = delete;
    virtual ~UntypedPublisherImpl() = default;

    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;

    void publish(void* const userPayload) noexcept;

    void release(void* const userPayload) noexcept;

  protected:
    using BasePublisherType::port;
};

} // namespace popo
} // namespace iox

#include "iceoryx_posh/internal/popo/untyped_publisher_impl.inl"

#endif // IOX_POSH_POPO_UNTYPED_PUBLISHER_IMPL_HPP

Updated on 18 December 2023 at 13:11:43 CET