PL::TypedBuffer class

template<class Type>
class TypedBuffer : public PL::Buffer

Class template for buffer with typed data member.

Template Parameters:

Type – data type

Public Functions

inline TypedBuffer()

Creates a typed buffer and allocates memory for its data.

inline TypedBuffer(size_t arraySize)

Creates a typed array buffer and allocates memory for its data.

Parameters:

arraySize – array size

inline TypedBuffer(Type *data)

Creates a typed buffer with preallocated data.

Parameters:

data – typed buffer data pointer

inline TypedBuffer(Type *data, size_t arraySize)

Creates a typed array buffer with preallocated data.

Parameters:
  • data – typed buffer data pointer

  • arraySize – array size

inline TypedBuffer(Type *data, std::shared_ptr<Lockable> lockable)

Creates a typed buffer with preallocated data and shared lockable.

Parameters:
  • data – typed buffer data pointer

  • lockable – lockable object that is locked when this typed buffer is locked

inline TypedBuffer(Type *data, size_t arraySize, std::shared_ptr<Lockable> lockable)

Creates a typed array buffer with preallocated data and shared lockable.

Parameters:
  • data – typed buffer data pointer

  • arraySize – array size

  • lockable – lockable object that is locked when this typed buffer is locked

virtual esp_err_t Lock(TickType_t timeout = portMAX_DELAY) override

Locks the object.

Parameters:

timeout – timeout in FreeRTOS ticks

Returns:

error code

virtual esp_err_t Unlock() override

Unlocks the object.

Returns:

error code

void Clear()

Sets all bytes of the buffer data to zero.

Public Members

Type *const data

typed buffer data pointer

const size_t size

buffer data size