iceoryx_posh 2.0.5
Loading...
Searching...
No Matches
roudi_memory_manager.hpp
1// Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2// Copyright (c) 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#ifndef IOX_POSH_ROUDI_MEMORY_ROUDI_MEMORY_MANAGER_HPP
18#define IOX_POSH_ROUDI_MEMORY_ROUDI_MEMORY_MANAGER_HPP
19
20#include "iceoryx_posh/iceoryx_posh_types.hpp"
21#include "iceoryx_posh/internal/roudi/memory/mempool_collection_memory_block.hpp"
22#include "iceoryx_posh/internal/roudi/memory/mempool_segment_manager_memory_block.hpp"
23#include "iceoryx_posh/internal/roudi/memory/port_pool_memory_block.hpp"
24#include "iceoryx_posh/roudi/memory/posix_shm_memory_provider.hpp"
25
26#include "iceoryx_hoofs/cxx/expected.hpp"
27#include "iceoryx_hoofs/cxx/optional.hpp"
28#include "iceoryx_hoofs/cxx/vector.hpp"
29
30#include <cstdint>
31
32namespace iox
33{
34namespace roudi
35{
36class MemoryProvider;
37
49
50iox::log::LogStream& operator<<(iox::log::LogStream& logstream, const RouDiMemoryManagerError& error) noexcept;
51
53{
54 public:
55 RouDiMemoryManager() noexcept = default;
57 virtual ~RouDiMemoryManager() noexcept;
58
60 RouDiMemoryManager& operator=(RouDiMemoryManager&&) = delete;
61
63 RouDiMemoryManager& operator=(const RouDiMemoryManager&) = delete;
64
69 cxx::expected<RouDiMemoryManagerError> addMemoryProvider(MemoryProvider* memoryProvider) noexcept;
70
75
78 cxx::expected<RouDiMemoryManagerError> destroyMemory() noexcept;
79
80 private:
81 mepoo::MePooConfig introspectionMemPoolConfig() const noexcept;
82 cxx::vector<MemoryProvider*, MAX_NUMBER_OF_MEMORY_PROVIDER> m_memoryProvider;
83};
84} // namespace roudi
85} // namespace iox
86
87#endif // IOX_POSH_ROUDI_MEMORY_ROUDI_MEMORY_MANAGER_HPP
This class creates memory which is requested by the MemoryBlocks. Once the memory is available,...
Definition memory_provider.hpp:69
Definition roudi_memory_manager.hpp:53
cxx::expected< RouDiMemoryManagerError > addMemoryProvider(MemoryProvider *memoryProvider) noexcept
This function add a MemoryProvider to the memory manager.
cxx::expected< RouDiMemoryManagerError > destroyMemory() noexcept
The RouDiMemoryManager calls the the MemoryProvider to destroy the memory, which in turn prompts the ...
cxx::expected< RouDiMemoryManagerError > createAndAnnounceMemory() noexcept
The RouDiMemoryManager calls the the MemoryProvider to create the memory and announce the availabilit...
virtual ~RouDiMemoryManager() noexcept
The Destructor of the RouDiMemoryManager also calls destroy on the registered MemoryProvider.
@ MEMORY_DESTRUCTION_FAILED
generic error if memory destruction failed
@ MEMORY_CREATION_FAILED
generic error if memory creation failed
RouDiMemoryManagerError
Definition roudi_memory_manager.hpp:39
@ NO_MEMORY_PROVIDER_PRESENT
an action was performed which requires memory provider
@ MEMORY_PROVIDER_EXHAUSTED
attempt to add more memory provider than the capacity allows