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

heap reference class More...

#include <heap.hpp>

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

Public Member Functions

constexpr heap_ref (native_pointer h) noexcept
 reference native heap object More...
 
template<class T_Heap >
constexpr heap_ref (T_Heap &h) noexcept
 reference heap object More...
 
constexpr heap_refoperator= (native_pointer h) noexcept
 assign new native heap object More...
 
template<class T_Heap >
constexpr heap_refoperator= (T_Heap &rhs) noexcept
 assign new heap object More...
 
constexpr auto native_handle () noexcept -> native_pointer
 get the native zephyr heap handle. More...
 
constexpr auto native_handle () const noexcept -> native_const_pointer
 get the native zephyr heap handle. More...
 
 heap_ref ()=delete
 
- Public Member Functions inherited from zpp::base_heap< heap_ref >
 base_heap (const base_heap &)=delete
 
 base_heap (base_heap &&)=delete
 
void * allocate (size_t bytes) noexcept
 Allocate memory from this heap wainting forever. More...
 
void * allocate (size_t bytes, size_t align) noexcept
 Allocate memory from this heap waiting forever. More...
 
void * try_allocate (size_t bytes) noexcept
 Allocate memory from this heap without waiting. More...
 
void * try_allocate (size_t bytes, size_t align) noexcept
 Allocate memory from this heap without waiting. More...
 
void * try_allocate_for (size_t bytes, const std::chrono::duration< T_Rep, T_Period > &timeout) noexcept
 Allocate memory from this heap waiting with a timeout. More...
 
void * try_allocate_for (size_t bytes, size_t align, const std::chrono::duration< T_Rep, T_Period > &timeout) noexcept
 Allocate memory from this heap waiting with a timeout. More...
 
void deallocate (void *mem) noexcept
 Deallocate memory previously allocated. More...
 
auto native_handle () noexcept -> native_pointer
 get the native zephyr heap handle. More...
 
auto native_handle () const noexcept -> native_const_pointer
 get the native zephyr heap handle. More...
 
base_heapoperator= (const base_heap &)=delete
 
base_heapoperator= (base_heap &&)=delete
 

Additional Inherited Members

- Public Types inherited from zpp::base_heap< heap_ref >
using native_type = struct k_heap
 
using native_pointer = native_type *
 
using native_const_pointer = native_type const *
 
- Protected Member Functions inherited from zpp::base_heap< heap_ref >
constexpr base_heap () noexcept
 default protected constructor so only derived objects can be created More...
 

Detailed Description

heap reference class

Warning
the referenced object must outlife the reference object

Definition at line 215 of file heap.hpp.

Constructor & Destructor Documentation

◆ heap_ref() [1/3]

constexpr zpp::heap_ref::heap_ref ( native_pointer  h)
inlineexplicitconstexprnoexcept

reference native heap object

Parameters
hthe native heap object
Warning
The native heap object h must be valid for the lifetime of this object

Definition at line 225 of file heap.hpp.

226  : m_heap(h)
227  {
228  __ASSERT_NO_MSG(m_heap != nullptr);
229  }

◆ heap_ref() [2/3]

template<class T_Heap >
constexpr zpp::heap_ref::heap_ref ( T_Heap &  h)
inlineexplicitconstexprnoexcept

reference heap object

Parameters
hthe heap object
Warning
The heap object h must be valid for the lifetime of this object

Definition at line 240 of file heap.hpp.

241  : m_heap(h.native_handle())
242  {
243  __ASSERT_NO_MSG(m_heap != nullptr);
244  }

◆ heap_ref() [3/3]

zpp::heap_ref::heap_ref ( )
delete

Member Function Documentation

◆ native_handle() [1/2]

constexpr auto zpp::heap_ref::native_handle ( ) const -> native_const_pointer
inlineconstexprnoexcept

get the native zephyr heap handle.

Returns
A pointer to the zephyr k_heap.

Definition at line 296 of file heap.hpp.

297  {
298  return m_heap;
299  }

◆ native_handle() [2/2]

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

get the native zephyr heap handle.

Returns
A pointer to the zephyr k_heap.

Definition at line 286 of file heap.hpp.

287  {
288  return m_heap;
289  }

◆ operator=() [1/2]

constexpr heap_ref& zpp::heap_ref::operator= ( native_pointer  h)
inlineconstexprnoexcept

assign new native heap object

Parameters
hthe native heap object
Returns
reference to this object
Warning
The native heap object h must be valid for the lifetime of this object

Definition at line 256 of file heap.hpp.

257  {
258  m_heap = h;
259  __ASSERT_NO_MSG(m_heap != nullptr);
260  return *this;
261  }

◆ operator=() [2/2]

template<class T_Heap >
constexpr heap_ref& zpp::heap_ref::operator= ( T_Heap &  rhs)
inlineconstexprnoexcept

assign new heap object

Parameters
hthe heap object
Returns
reference to this object
Warning
The heap object h must be valid for the lifetime of this object

Definition at line 274 of file heap.hpp.

275  {
276  m_heap = rhs.native_handle();
277  __ASSERT_NO_MSG(m_heap != nullptr);
278  return *this;
279  }

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