iceoryx_doc  1.0.1
mempool_collection_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_COLLECTION_MEMORY_BLOCK_HPP
17 #define IOX_POSH_ROUDI_MEMORY_MEMPOOL_COLLECTION_MEMORY_BLOCK_HPP
18 
19 #include "iceoryx_posh/roudi/memory/memory_block.hpp"
20 
21 #include "iceoryx_posh/mepoo/mepoo_config.hpp"
22 
23 #include "iceoryx_utils/cxx/optional.hpp"
24 
25 #include <cstdint>
26 
27 namespace iox
28 {
29 namespace mepoo
30 {
31 class MemoryManager;
32 }
33 
34 namespace roudi
35 {
38 {
39  public:
40  MemPoolCollectionMemoryBlock(const mepoo::MePooConfig& memPoolConfig) noexcept;
41  ~MemPoolCollectionMemoryBlock() noexcept;
42 
47 
50  uint64_t size() const noexcept override;
51 
54  uint64_t alignment() const noexcept override;
55 
59  void memoryAvailable(void* memory) noexcept override;
60 
63  void destroy() noexcept override;
64 
67  cxx::optional<mepoo::MemoryManager*> memoryManager() const noexcept;
68 
69  private:
70  mepoo::MePooConfig m_memPoolConfig;
71  mepoo::MemoryManager* m_memoryManager{nullptr};
72 };
73 
74 } // namespace roudi
75 } // namespace iox
76 
77 #endif // IOX_POSH_ROUDI_MEMORY_MEMPOOL_COLLECTION_MEMORY_BLOCK_HPP
The MemPoolCollectionMemoryBlock is an implementation of a MemoryBlock for a MemPool MemoryManager.
Definition: mempool_collection_memory_block.hpp:38
void memoryAvailable(void *memory) noexcept override
Implementation of MemoryBlock::memoryAvailable This will create the MemPools.
cxx::optional< mepoo::MemoryManager * > memoryManager() const noexcept
This function enables the access to the MemoryManager for the MemPools.
void destroy() noexcept override
Implementation of MemoryBlock::destroy This will clean up the MemPools.
uint64_t alignment() const noexcept override
Implementation of MemoryBlock::alignment.
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: mepoo_config.hpp:33