ESPHome 2026.3.0-dev
Loading...
Searching...
No Matches
esphome::SmallBufferWithHeapFallback< STACK_SIZE, T > Class Template Reference

Helper class for efficient buffer allocation - uses stack for small sizes, heap for large This is useful when most operations need a small buffer but occasionally need larger ones. More...

#include <helpers.h>

Public Member Functions

 SmallBufferWithHeapFallback (size_t size)
 
 ~SmallBufferWithHeapFallback ()
 
 SmallBufferWithHeapFallback (const SmallBufferWithHeapFallback &)=delete
 
SmallBufferWithHeapFallbackoperator= (const SmallBufferWithHeapFallback &)=delete
 
 SmallBufferWithHeapFallback (SmallBufferWithHeapFallback &&)=delete
 
SmallBufferWithHeapFallbackoperator= (SmallBufferWithHeapFallback &&)=delete
 
T * get ()
 

Detailed Description

template<size_t STACK_SIZE, typename T = uint8_t>
class esphome::SmallBufferWithHeapFallback< STACK_SIZE, T >

Helper class for efficient buffer allocation - uses stack for small sizes, heap for large This is useful when most operations need a small buffer but occasionally need larger ones.

The stack buffer avoids heap allocation in the common case, while heap fallback handles edge cases.

Template Parameters
STACK_SIZENumber of elements in the stack buffer
TElement type (default: uint8_t)

Definition at line 411 of file helpers.h.

Constructor & Destructor Documentation

◆ SmallBufferWithHeapFallback() [1/3]

template<size_t STACK_SIZE, typename T = uint8_t>
esphome::SmallBufferWithHeapFallback< STACK_SIZE, T >::SmallBufferWithHeapFallback ( size_t size)
inlineexplicit

Definition at line 413 of file helpers.h.

◆ ~SmallBufferWithHeapFallback()

template<size_t STACK_SIZE, typename T = uint8_t>
esphome::SmallBufferWithHeapFallback< STACK_SIZE, T >::~SmallBufferWithHeapFallback ( )
inline

Definition at line 421 of file helpers.h.

◆ SmallBufferWithHeapFallback() [2/3]

template<size_t STACK_SIZE, typename T = uint8_t>
esphome::SmallBufferWithHeapFallback< STACK_SIZE, T >::SmallBufferWithHeapFallback ( const SmallBufferWithHeapFallback< STACK_SIZE, T > & )
delete

◆ SmallBufferWithHeapFallback() [3/3]

template<size_t STACK_SIZE, typename T = uint8_t>
esphome::SmallBufferWithHeapFallback< STACK_SIZE, T >::SmallBufferWithHeapFallback ( SmallBufferWithHeapFallback< STACK_SIZE, T > && )
delete

Member Function Documentation

◆ get()

template<size_t STACK_SIZE, typename T = uint8_t>
T * esphome::SmallBufferWithHeapFallback< STACK_SIZE, T >::get ( )
inline

Definition at line 429 of file helpers.h.

◆ operator=() [1/2]

template<size_t STACK_SIZE, typename T = uint8_t>
SmallBufferWithHeapFallback & esphome::SmallBufferWithHeapFallback< STACK_SIZE, T >::operator= ( const SmallBufferWithHeapFallback< STACK_SIZE, T > & )
delete

◆ operator=() [2/2]

template<size_t STACK_SIZE, typename T = uint8_t>
SmallBufferWithHeapFallback & esphome::SmallBufferWithHeapFallback< STACK_SIZE, T >::operator= ( SmallBufferWithHeapFallback< STACK_SIZE, T > && )
delete

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