ESPHome  2024.11.0
Public Types | Public Member Functions
esphome::RAMAllocator< T > Class Template Reference

An STL allocator that uses SPI or internal RAM. More...

#include <helpers.h>

Public Types

enum  Flags { NONE = 0, ALLOC_EXTERNAL = 1 << 0, ALLOC_INTERNAL = 1 << 1, ALLOW_FAILURE = 1 << 2 }
 
using value_type = T
 

Public Member Functions

 RAMAllocator ()=default
 
 RAMAllocator (uint8_t flags)
 
template<class U >
constexpr RAMAllocator (const RAMAllocator< U > &other)
 
T * allocate (size_t n)
 
void deallocate (T *p, size_t n)
 

Detailed Description

template<class T>
class esphome::RAMAllocator< T >

An STL allocator that uses SPI or internal RAM.

Returns nullptr in case no memory is available.

By setting flags, it can be configured to:

Definition at line 666 of file helpers.h.

Member Typedef Documentation

◆ value_type

template<class T>
using esphome::RAMAllocator< T >::value_type = T

Definition at line 668 of file helpers.h.

Member Enumeration Documentation

◆ Flags

template<class T>
enum esphome::RAMAllocator::Flags
Enumerator
NONE 
ALLOC_EXTERNAL 
ALLOC_INTERNAL 
ALLOW_FAILURE 

Definition at line 670 of file helpers.h.

Constructor & Destructor Documentation

◆ RAMAllocator() [1/3]

template<class T>
esphome::RAMAllocator< T >::RAMAllocator ( )
default

◆ RAMAllocator() [2/3]

template<class T>
esphome::RAMAllocator< T >::RAMAllocator ( uint8_t  flags)
inline

Definition at line 678 of file helpers.h.

◆ RAMAllocator() [3/3]

template<class T>
template<class U >
constexpr esphome::RAMAllocator< T >::RAMAllocator ( const RAMAllocator< U > &  other)
inline

Definition at line 679 of file helpers.h.

Member Function Documentation

◆ allocate()

template<class T>
T* esphome::RAMAllocator< T >::allocate ( size_t  n)
inline

Definition at line 681 of file helpers.h.

◆ deallocate()

template<class T>
void esphome::RAMAllocator< T >::deallocate ( T *  p,
size_t  n 
)
inline

Definition at line 700 of file helpers.h.


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