zpp
Zephyr C++20 Framework
|
Allocator that uses k_mem_slab for memory. More...
#include <mem_slab.hpp>
Public Types | |
using | native_type = struct k_mem_slab |
using | native_pointer = native_type * |
using | native_const_pointer = native_type const * |
Public Member Functions | |
void * | allocate () noexcept |
allocate a memory block, waiting forever More... | |
void * | try_allocate () noexcept |
try allocate a memory block, not waiting More... | |
template<class T_Rep , class T_Period > | |
void * | try_allocate_for (const std::chrono::duration< T_Rep, T_Period > &timeout) noexcept |
try allocate a memory block waiting with a timeout More... | |
void | deallocate (void *vp) noexcept |
deallocate memory More... | |
constexpr auto | block_size () const noexcept |
the size of the memory blocks More... | |
constexpr auto | total_block_count () const noexcept |
get maximm number of blocks that can be allocated More... | |
constexpr auto | used_block_count () noexcept |
get current number of used blocks More... | |
constexpr auto | free_block_count () noexcept |
get current number of free blocks More... | |
auto | native_handle () noexcept -> native_pointer |
get the native zephyr mem slab handle. More... | |
auto | native_handle () const noexcept -> native_const_pointer |
get the native zephyr mem slab handle. More... | |
mem_slab_base (const mem_slab_base &)=delete | |
mem_slab_base (mem_slab_base &&)=delete | |
mem_slab_base & | operator= (const mem_slab_base &)=delete |
mem_slab_base & | operator= (mem_slab_base &&)=delete |
Protected Member Functions | |
constexpr | mem_slab_base () noexcept |
Allocator that uses k_mem_slab for memory.
T_MemSlab | the CRTP type |
Definition at line 27 of file mem_slab.hpp.
using zpp::mem_slab_base< T_MemSlab >::native_const_pointer = native_type const * |
Definition at line 31 of file mem_slab.hpp.
using zpp::mem_slab_base< T_MemSlab >::native_pointer = native_type* |
Definition at line 30 of file mem_slab.hpp.
using zpp::mem_slab_base< T_MemSlab >::native_type = struct k_mem_slab |
Definition at line 29 of file mem_slab.hpp.
|
inlineconstexprprotectednoexcept |
Definition at line 33 of file mem_slab.hpp.
|
delete |
|
delete |
|
inlinenoexcept |
allocate a memory block, waiting forever
Definition at line 41 of file mem_slab.hpp.
References zpp::mem_slab_base< T_MemSlab >::native_handle().
|
inlineconstexprnoexcept |
the size of the memory blocks
Definition at line 114 of file mem_slab.hpp.
References zpp::mem_slab_base< T_MemSlab >::native_handle().
|
inlinenoexcept |
deallocate memory
vp | the pointer to free |
Definition at line 102 of file mem_slab.hpp.
References zpp::mem_slab_base< T_MemSlab >::native_handle().
|
inlineconstexprnoexcept |
get current number of free blocks
Definition at line 144 of file mem_slab.hpp.
References zpp::mem_slab_base< T_MemSlab >::native_handle().
|
inlinenoexcept |
get the native zephyr mem slab handle.
Definition at line 165 of file mem_slab.hpp.
References zpp::mem_slab_base< T_MemSlab >::native_handle().
|
inlinenoexcept |
get the native zephyr mem slab handle.
Definition at line 155 of file mem_slab.hpp.
Referenced by zpp::mem_slab_base< T_MemSlab >::allocate(), zpp::mem_slab_base< T_MemSlab >::block_size(), zpp::mem_slab_base< T_MemSlab >::deallocate(), zpp::mem_slab_base< T_MemSlab >::free_block_count(), zpp::mem_slab_base< T_MemSlab >::native_handle(), zpp::mem_slab_base< T_MemSlab >::total_block_count(), zpp::mem_slab_base< T_MemSlab >::try_allocate(), zpp::mem_slab_base< T_MemSlab >::try_allocate_for(), and zpp::mem_slab_base< T_MemSlab >::used_block_count().
|
delete |
|
delete |
|
inlineconstexprnoexcept |
get maximm number of blocks that can be allocated
Definition at line 124 of file mem_slab.hpp.
References zpp::mem_slab_base< T_MemSlab >::native_handle().
|
inlinenoexcept |
try allocate a memory block, not waiting
Definition at line 60 of file mem_slab.hpp.
References zpp::mem_slab_base< T_MemSlab >::native_handle().
|
inlinenoexcept |
try allocate a memory block waiting with a timeout
timeout | the time to try |
Definition at line 82 of file mem_slab.hpp.
References zpp::mem_slab_base< T_MemSlab >::native_handle(), and zpp::to_timeout().
|
inlineconstexprnoexcept |
get current number of used blocks
Definition at line 134 of file mem_slab.hpp.
References zpp::mem_slab_base< T_MemSlab >::native_handle().