Mbed OS Reference
Loading...
Searching...
No Matches
DynamicCacheAlignedBuffer< DataT > Class Template Reference

CacheAlignedBuffer type which allocates its backing buffer on the heap. More...

#include <CacheAlignedBuffer.h>

Inheritance diagram for DynamicCacheAlignedBuffer< DataT >:
CacheAlignedBuffer< DataT >

Public Member Functions

 DynamicCacheAlignedBuffer (size_t capacity)
 Construct new cache-aligned buffer.
 
 DynamicCacheAlignedBuffer (DynamicCacheAlignedBuffer const &other)
 Copy from other cache-aligned buffer.
 
DynamicCacheAlignedBufferoperator= (DynamicCacheAlignedBuffer const &other)
 Assign from other cache-aligned buffer with the same type.
 
DataT * data ()
 Get a pointer to the aligned data array inside the buffer.
 
DataT const * data () const
 Get a pointer to the aligned data array inside the buffer (const version)
 
DataT & operator[] (size_t index)
 Element access.
 
DataT operator[] (size_t index) const
 Element access (const)
 
iterator begin ()
 Get iterator for start of buffer.
 
const_iterator begin () const
 Get iterator for start of buffer.
 
iterator end ()
 Get iterator for end of buffer.
 
const_iterator end () const
 Get iterator for end of buffer.
 
constexpr size_t capacity ()
 

Static Protected Member Functions

static DataT * findCacheLineStart (uint8_t *buffer)
 Find and return the first location in the given buffer that starts on a cache line.
 

Protected Attributes

DataT * _alignedBufferPtr
 Pointer to the aligned buffer. Must be set in each constructor of each subclass.
 
size_t _alignedBufferCapacity
 Capacity of the aligned buffer, in terms of number of DataT elements.
 

Detailed Description

template<typename DataT>
class mbed::DynamicCacheAlignedBuffer< DataT >

CacheAlignedBuffer type which allocates its backing buffer on the heap.

Use a DynamicCacheAlignedBuffer when you want to create a cache-aligned buffer with a size known only at runtime. When constructed, DynamicCacheAlignedBuffers allocate backing memory off the heap for the provided number of elements, plus a little extra for alignment. The memory will be deleted when the buffer object is destroyed.

Template Parameters
DataTType of the data to store in the buffer. Note: CacheAlignedBuffer is not designed for using class types as DataT, and will not call constructors.

Definition at line 285 of file CacheAlignedBuffer.h.