iceoryx_doc  1.0.1
mempool_segment_manager_memory_block.hpp
1 // Copyright (c) 2020 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_MEMPOOL_SEGMENT_MANAGER_MEMORY_BLOCK_HPP
17 #define IOX_POSH_ROUDI_MEMORY_MEMPOOL_SEGMENT_MANAGER_MEMORY_BLOCK_HPP
18 
19 #include "iceoryx_posh/roudi/memory/memory_block.hpp"
20 
21 #include "iceoryx_posh/internal/mepoo/segment_manager.hpp"
22 #include "iceoryx_posh/mepoo/segment_config.hpp"
23 
24 #include "iceoryx_utils/cxx/optional.hpp"
25 
26 #include <cstdint>
27 
28 namespace iox
29 {
30 namespace roudi
31 {
33 {
34  public:
35  MemPoolSegmentManagerMemoryBlock(const mepoo::SegmentConfig& segmentConfig) noexcept;
37 
42 
45  uint64_t size() const noexcept override;
46 
49  uint64_t alignment() const noexcept override;
50 
54  void memoryAvailable(void* memory) noexcept override;
55 
58  void destroy() noexcept override;
59 
62  cxx::optional<mepoo::SegmentManager<>*> segmentManager() const noexcept;
63 
64  private:
65  mepoo::SegmentManager<>* m_segmentManager{nullptr};
66  mepoo::SegmentConfig m_segmentConfig;
67 };
68 
69 } // namespace roudi
70 } // namespace iox
71 
72 #endif // IOX_POSH_ROUDI_MEMORY_MEMPOOL_SEGMENT_MANAGER_MEMORY_BLOCK_HPP
Definition: mempool_segment_manager_memory_block.hpp:33
cxx::optional< mepoo::SegmentManager<> * > segmentManager() const noexcept
This function enables the access to the SegmentManager.
uint64_t alignment() const noexcept override
Implementation of MemoryBlock::alignment.
void destroy() noexcept override
Implementation of MemoryBlock::destroy This will clean up the SegmentManager.
void memoryAvailable(void *memory) noexcept override
Implementation of MemoryBlock::memoryAvailable This will create the SegmentManager.
uint64_t size() const noexcept override
Implementation of MemoryBlock::size.
The MemoryBlock is a container for general purpose memory. It is used to request some memory from a M...
Definition: memory_block.hpp:32
cxx::optional< void * > memory() const noexcept
This function provides the pointer to the requested memory.
Definition: service_description.hpp:29
Definition: segment_config.hpp:31