iceoryx_posh  2.0.2
roudi_memory_interface.hpp
1 // Copyright (c) 2020, 2021 by Robert Bosch GmbH. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // SPDX-License-Identifier: Apache-2.0
16 #ifndef IOX_POSH_ROUDI_MEMORY_ROUDI_MEMORY_INTERFACE_HPP
17 #define IOX_POSH_ROUDI_MEMORY_ROUDI_MEMORY_INTERFACE_HPP
18 
19 #include "iceoryx_hoofs/cxx/optional.hpp"
20 #include "iceoryx_posh/internal/roudi/memory/mempool_collection_memory_block.hpp"
21 #include "iceoryx_posh/internal/roudi/memory/mempool_segment_manager_memory_block.hpp"
22 #include "iceoryx_posh/internal/roudi/memory/port_pool_memory_block.hpp"
23 #include "iceoryx_posh/roudi/memory/posix_shm_memory_provider.hpp"
24 #include "iceoryx_posh/roudi/memory/roudi_memory_manager.hpp"
25 #include "iceoryx_posh/roudi/port_pool.hpp"
26 
27 #include <cstdint>
28 
29 namespace iox
30 {
31 namespace roudi
32 {
33 class MemoryProvider;
34 
36 {
37  public:
38  RouDiMemoryInterface() noexcept = default;
40  virtual ~RouDiMemoryInterface() noexcept = default;
41 
43  RouDiMemoryInterface& operator=(RouDiMemoryInterface&&) = delete;
44 
46  RouDiMemoryInterface& operator=(const RouDiMemoryInterface&) = delete;
47 
51  virtual cxx::expected<RouDiMemoryManagerError> createAndAnnounceMemory() noexcept = 0;
52 
55  virtual cxx::expected<RouDiMemoryManagerError> destroyMemory() noexcept = 0;
56 
57  virtual const PosixShmMemoryProvider* mgmtMemoryProvider() const noexcept = 0;
58  virtual cxx::optional<PortPool*> portPool() noexcept = 0;
59  virtual cxx::optional<mepoo::MemoryManager*> introspectionMemoryManager() const noexcept = 0;
60  virtual cxx::optional<mepoo::SegmentManager<>*> segmentManager() const noexcept = 0;
61 };
62 } // namespace roudi
63 } // namespace iox
64 
65 #endif // IOX_POSH_ROUDI_MEMORY_ROUDI_MEMORY_INTERFACE_HPP
Definition: port_pool.hpp:62
Creates the shared memory based on a provided configuration.
Definition: posix_shm_memory_provider.hpp:36
Definition: roudi_memory_interface.hpp:36
virtual cxx::expected< RouDiMemoryManagerError > createAndAnnounceMemory() noexcept=0
The RouDiMemoryManager calls the the MemoryProvider to create the memory and announce the availabilit...
virtual cxx::expected< RouDiMemoryManagerError > destroyMemory() noexcept=0
The RouDiMemoryManager calls the the MemoryProvider to destroy the memory, which in turn prompts the ...
virtual ~RouDiMemoryInterface() noexcept=default
The Destructor of the RouDiMemoryInterface also calls destroy on the registered MemoryProvider.
RouDiMemoryManagerError
Definition: roudi_memory_manager.hpp:39