zpp
Zephyr C++20 Framework
zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align > Class Template Reference

A memory slab class. More...

#include <mem_slab.hpp>

Inheritance diagram for zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >:
[legend]
Collaboration diagram for zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >:
[legend]

Public Member Functions

 mem_slab () noexcept
 Default constructor. More...
 
constexpr auto native_handle () noexcept -> native_pointer
 get the native zephyr mem slab handle. More...
 
constexpr auto native_handle () const noexcept -> native_const_pointer
 get the native zephyr mem slab handle. More...
 
 mem_slab (const mem_slab &)=delete
 
 mem_slab (mem_slab &&)=delete
 
mem_slaboperator= (const mem_slab &)=delete
 
mem_slaboperator= (mem_slab &&)=delete
 
- Public Member Functions inherited from zpp::mem_slab_base< mem_slab< T_BlockSize, T_BlockCount, sizeof(void *) > >
 mem_slab_base (const mem_slab_base &)=delete
 
 mem_slab_base (mem_slab_base &&)=delete
 
void * allocate () noexcept
 allocate a memory block, waiting forever More...
 
void * try_allocate () noexcept
 try allocate a memory block, not waiting More...
 
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_baseoperator= (const mem_slab_base &)=delete
 
mem_slab_baseoperator= (mem_slab_base &&)=delete
 

Additional Inherited Members

- Public Types inherited from zpp::mem_slab_base< mem_slab< T_BlockSize, T_BlockCount, sizeof(void *) > >
using native_type = struct k_mem_slab
 
using native_pointer = native_type *
 
using native_const_pointer = native_type const *
 
- Protected Member Functions inherited from zpp::mem_slab_base< mem_slab< T_BlockSize, T_BlockCount, sizeof(void *) > >
constexpr mem_slab_base () noexcept
 

Detailed Description

template<uint32_t T_BlockSize, uint32_t T_BlockCount, uint32_t T_Align = sizeof(void*)>
class zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >

A memory slab class.

Definition at line 181 of file mem_slab.hpp.

Constructor & Destructor Documentation

◆ mem_slab() [1/3]

template<uint32_t T_BlockSize, uint32_t T_BlockCount, uint32_t T_Align = sizeof(void*)>
zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >::mem_slab ( )
inlinenoexcept

Default constructor.

Definition at line 197 of file mem_slab.hpp.

198  {
199  k_mem_slab_init(&m_mem_slab, m_mem_buffer.data(), T_BlockSize, T_BlockCount);
200  }

◆ mem_slab() [2/3]

template<uint32_t T_BlockSize, uint32_t T_BlockCount, uint32_t T_Align = sizeof(void*)>
zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >::mem_slab ( const mem_slab< T_BlockSize, T_BlockCount, T_Align > &  )
delete

◆ mem_slab() [3/3]

template<uint32_t T_BlockSize, uint32_t T_BlockCount, uint32_t T_Align = sizeof(void*)>
zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >::mem_slab ( mem_slab< T_BlockSize, T_BlockCount, T_Align > &&  )
delete

Member Function Documentation

◆ native_handle() [1/2]

template<uint32_t T_BlockSize, uint32_t T_BlockCount, uint32_t T_Align = sizeof(void*)>
constexpr auto zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >::native_handle ( ) const -> native_const_pointer
inlineconstexprnoexcept

get the native zephyr mem slab handle.

Returns
A pointer to the zephyr k_mem_slab.

Definition at line 217 of file mem_slab.hpp.

218  {
219  return &m_mem_slab;
220  }

◆ native_handle() [2/2]

template<uint32_t T_BlockSize, uint32_t T_BlockCount, uint32_t T_Align = sizeof(void*)>
constexpr auto zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >::native_handle ( ) -> native_pointer
inlineconstexprnoexcept

get the native zephyr mem slab handle.

Returns
A pointer to the zephyr k_mem_slab.

Definition at line 207 of file mem_slab.hpp.

208  {
209  return &m_mem_slab;
210  }

◆ operator=() [1/2]

template<uint32_t T_BlockSize, uint32_t T_BlockCount, uint32_t T_Align = sizeof(void*)>
mem_slab& zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >::operator= ( const mem_slab< T_BlockSize, T_BlockCount, T_Align > &  )
delete

◆ operator=() [2/2]

template<uint32_t T_BlockSize, uint32_t T_BlockCount, uint32_t T_Align = sizeof(void*)>
mem_slab& zpp::mem_slab< T_BlockSize, T_BlockCount, T_Align >::operator= ( mem_slab< T_BlockSize, T_BlockCount, T_Align > &&  )
delete

The documentation for this class was generated from the following file: