zpp
Zephyr C++20 Framework
zpp::mem_slab_ref Class Reference

A mem_slab class referencing another mem slab object. More...

#include <mem_slab.hpp>

Inheritance diagram for zpp::mem_slab_ref:
[legend]
Collaboration diagram for zpp::mem_slab_ref:
[legend]

Public Member Functions

constexpr mem_slab_ref (native_pointer m) noexcept
 Construct a reference to a native k_mem_slab*. More...
 
template<class T_MemSlab >
constexpr mem_slab_ref (T_MemSlab &m) noexcept
 Construct a reference to another mem_slab object. More...
 
constexpr mem_slab_refoperator= (native_pointer m) noexcept
 Assign a new native k_mem_slab* object. More...
 
template<class T_MemSlab >
constexpr mem_slab_refoperator= (T_MemSlab &m) noexcept
 Assign a new native mem slab object. 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_ref ()=delete
 
- Public Member Functions inherited from zpp::mem_slab_base< mem_slab_ref >
 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_ref >
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_ref >
constexpr mem_slab_base () noexcept
 

Detailed Description

A mem_slab class referencing another mem slab object.

Definition at line 234 of file mem_slab.hpp.

Constructor & Destructor Documentation

◆ mem_slab_ref() [1/3]

constexpr zpp::mem_slab_ref::mem_slab_ref ( native_pointer  m)
inlineexplicitconstexprnoexcept

Construct a reference to a native k_mem_slab*.

Parameters
mThe k_mem_slab to reference. m must already be initialized and will not be freed.

Definition at line 242 of file mem_slab.hpp.

243  : m_mem_slab_ptr(m)
244  {
245  __ASSERT_NO_MSG(m_mem_slab_ptr != nullptr);
246  }

◆ mem_slab_ref() [2/3]

template<class T_MemSlab >
constexpr zpp::mem_slab_ref::mem_slab_ref ( T_MemSlab &  m)
inlineexplicitconstexprnoexcept

Construct a reference to another mem_slab object.

Parameters
mThe object to reference. m must already be initialized and will not be freed.

Definition at line 255 of file mem_slab.hpp.

256  : m_mem_slab_ptr(m.native_handle())
257  {
258  __ASSERT_NO_MSG(m_mem_slab_ptr != nullptr);
259  }

◆ mem_slab_ref() [3/3]

zpp::mem_slab_ref::mem_slab_ref ( )
delete

Member Function Documentation

◆ native_handle() [1/2]

constexpr auto zpp::mem_slab_ref::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 307 of file mem_slab.hpp.

308  {
309  return m_mem_slab_ptr;
310  }

◆ native_handle() [2/2]

constexpr auto zpp::mem_slab_ref::native_handle ( ) -> native_pointer
inlineconstexprnoexcept

get the native zephyr mem slab handle.

Returns
A pointer to the zephyr k_mem_slab.

Definition at line 297 of file mem_slab.hpp.

298  {
299  return m_mem_slab_ptr;
300  }

Referenced by operator=().

◆ operator=() [1/2]

constexpr mem_slab_ref& zpp::mem_slab_ref::operator= ( native_pointer  m)
inlineconstexprnoexcept

Assign a new native k_mem_slab* object.

Parameters
mThe k_mem_slab to reference. m must already be initialized and will not be freed.
Returns
reference to this object

Definition at line 269 of file mem_slab.hpp.

270  {
271  m_mem_slab_ptr = m;
272  __ASSERT_NO_MSG(m_mem_slab_ptr != nullptr);
273  return *this;
274  }

◆ operator=() [2/2]

template<class T_MemSlab >
constexpr mem_slab_ref& zpp::mem_slab_ref::operator= ( T_MemSlab &  m)
inlineconstexprnoexcept

Assign a new native mem slab object.

Parameters
mThe object to reference. m must already be initialized and will not be freed.
Returns
reference to this object

Definition at line 285 of file mem_slab.hpp.

286  {
287  m_mem_slab_ptr = m.native_handle();
288  __ASSERT_NO_MSG(m_mem_slab_ptr != nullptr);
289  return *this;
290  }

References native_handle().


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