17 #ifndef IOX_POSH_MEPOO_MEM_POOL_HPP
18 #define IOX_POSH_MEPOO_MEM_POOL_HPP
20 #include "iceoryx_posh/mepoo/chunk_header.hpp"
21 #include "iceoryx_utils/cxx/helplets.hpp"
22 #include "iceoryx_utils/internal/concurrent/loffli.hpp"
23 #include "iceoryx_utils/internal/posix_wrapper/shared_memory_object/allocator.hpp"
24 #include "iceoryx_utils/internal/relocatable_pointer/relative_pointer.hpp"
37 const uint32_t minFreeChunks,
38 const uint32_t numChunks,
39 const uint32_t chunkSize) noexcept;
41 uint32_t m_usedChunks{0};
42 uint32_t m_minFreeChunks{0};
43 uint32_t m_numChunks{0};
44 uint32_t m_chunkSize{0};
50 using freeList_t = concurrent::LoFFLi;
51 static constexpr uint64_t CHUNK_MEMORY_ALIGNMENT = 8U;
53 MemPool(
const cxx::greater_or_equal<uint32_t, CHUNK_MEMORY_ALIGNMENT> chunkSize,
54 const cxx::greater_or_equal<uint32_t, 1> numberOfChunks,
55 posix::Allocator& managementAllocator,
56 posix::Allocator& chunkMemoryAllocator) noexcept;
63 void* getChunk() noexcept;
64 uint32_t getChunkSize()
const noexcept;
65 uint32_t getChunkCount()
const noexcept;
66 uint32_t getUsedChunks()
const noexcept;
67 uint32_t getMinFree()
const noexcept;
70 void freeChunk(
const void* chunk) noexcept;
73 void adjustMinFree() noexcept;
74 bool isMultipleOfAlignment(
const uint32_t value)
const noexcept;
76 rp::RelativePointer<uint8_t> m_rawMemory;
78 uint32_t m_chunkSize{0U};
81 uint32_t m_numberOfChunks{0U};
84 std::atomic<uint32_t> m_usedChunks{0U};
85 std::atomic<uint32_t> m_minFree{0U};
88 freeList_t m_freeIndices;
Definition: mem_pool.hpp:48
Definition: service_description.hpp:29
Definition: mem_pool.hpp:35