iceoryx_posh/roudi/memory/memory_block.hpp🔗
Namespaces🔗
Name |
---|
iox |
iox::roudi |
Classes🔗
Name | |
---|---|
class | iox::roudi::MemoryBlock The MemoryBlock is a container for general purpose memory. It is used to request some memory from a MemoryProvider, which can be POSIX SHM, the stack or something completely different. To be able to use the container, some functions need to be implemented. For most use cases the GenericMemoryBlock can be used, which is a templated class and implements the most common 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_MEMORY_BLOCK_HPP
#define IOX_POSH_ROUDI_MEMORY_MEMORY_BLOCK_HPP
#include "iceoryx_hoofs/cxx/helplets.hpp"
#include "iceoryx_hoofs/cxx/optional.hpp"
#include <cstdint>
namespace iox
{
namespace roudi
{
class MemoryBlock
{
friend class MemoryProvider;
public:
MemoryBlock() noexcept = default;
virtual ~MemoryBlock() noexcept = default;
MemoryBlock(const MemoryBlock&) = delete;
MemoryBlock(MemoryBlock&&) = delete;
MemoryBlock& operator=(const MemoryBlock&) = delete;
MemoryBlock& operator=(MemoryBlock&&) = delete;
virtual uint64_t size() const noexcept = 0;
virtual uint64_t alignment() const noexcept = 0;
cxx::optional<void*> memory() const noexcept;
protected:
virtual void destroy() noexcept = 0;
virtual void onMemoryAvailable(cxx::not_null<void*> memory) noexcept;
private:
void* m_memory{nullptr};
};
} // namespace roudi
} // namespace iox
#endif // IOX_POSH_ROUDI_MEMORY_MEMORY_BLOCK_HPP
Updated on 18 December 2023 at 13:11:43 CET