iceoryx_posh/roudi/memory/generic_memory_block.hpp🔗
Namespaces🔗
Name |
---|
iox |
iox::roudi |
Classes🔗
Name | |
---|---|
class | iox::roudi::GenericMemoryBlock The GenericMemoryBlock is an implementation of a MemoryBlock for a common use case. |
Source code🔗
// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
// Copyright (c) 2021 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_ROUDI_MEMORY_GENERIC_MEMORY_BLOCK_HPP
#define IOX_POSH_ROUDI_MEMORY_GENERIC_MEMORY_BLOCK_HPP
#include "iceoryx_posh/roudi/memory/memory_block.hpp"
#include "iceoryx_hoofs/cxx/optional.hpp"
#include <cstdint>
namespace iox
{
namespace roudi
{
template <typename T>
class GenericMemoryBlock final : public MemoryBlock
{
friend class MemoryProvider;
public:
GenericMemoryBlock() noexcept = default;
~GenericMemoryBlock() noexcept;
GenericMemoryBlock(const GenericMemoryBlock&) = delete;
GenericMemoryBlock(GenericMemoryBlock&&) = delete;
GenericMemoryBlock& operator=(const GenericMemoryBlock&) = delete;
GenericMemoryBlock& operator=(GenericMemoryBlock&&) = delete;
uint64_t size() const noexcept override;
uint64_t alignment() const noexcept override;
template <typename... Targs>
cxx::optional<T*> emplace(Targs&&... args) noexcept;
cxx::optional<T*> value() const noexcept;
protected:
void destroy() noexcept override;
private:
T* m_value{nullptr};
};
} // namespace roudi
} // namespace iox
#include "iceoryx_posh/internal/roudi/memory/generic_memory_block.inl"
#endif // IOX_POSH_ROUDI_MEMORY_GENERIC_MEMORY_BLOCK_HPP
Updated on 18 December 2023 at 13:11:43 CET