28template <
typename T, u
int16_t S>
43 uint16_t
getMaxSize(uint16_t byteSize) {
return (byteSize - 2) /
sizeof(T); }
52 LOGw(
"Could not allocate memory");
73 LOGd(
"Could not assign at %u", buffer);
Definition: cs_StackBuffer.h:35
stack_buffer_t< T > * _buffer
Definition: cs_StackBuffer.h:124
bool assign(buffer_ptr_t buffer, uint16_t bufferSize)
Definition: cs_StackBuffer.h:71
bool deinit()
Definition: cs_StackBuffer.h:62
uint16_t getMaxByteSize()
Definition: cs_StackBuffer.h:42
void clear()
Definition: cs_StackBuffer.h:93
uint16_t size() const
Definition: cs_StackBuffer.h:95
T operator[](uint16_t idx) const
Definition: cs_StackBuffer.h:117
bool empty() const
Definition: cs_StackBuffer.h:99
uint16_t capacity() const
Definition: cs_StackBuffer.h:97
virtual ~StackBuffer()
Definition: cs_StackBuffer.h:39
bool full() const
Definition: cs_StackBuffer.h:101
bool init()
Definition: cs_StackBuffer.h:45
bool release()
Definition: cs_StackBuffer.h:83
uint16_t _capacity
Definition: cs_StackBuffer.h:125
T pop()
Definition: cs_StackBuffer.h:112
StackBuffer(uint16_t capacity)
Definition: cs_StackBuffer.h:37
bool push(T value)
Definition: cs_StackBuffer.h:103
stack_buffer_t< T > * getBuffer()
Definition: cs_StackBuffer.h:91
uint16_t getMaxByteSize(uint16_t capacity)
Definition: cs_StackBuffer.h:41
uint16_t getMaxSize(uint16_t byteSize)
Definition: cs_StackBuffer.h:43
bool _allocatedSelf
Definition: cs_StackBuffer.h:126
#define assert(expr, message)
Author: Crownstone Team Date: 21 Sep., 2013 License: LGPLv3+, Apache License 2.0, and/or MIT (triple-...
Definition: cs_Error.h:22
#define LOGw(fmt,...)
Definition: cs_Logger.h:92
#define LOGd(fmt,...)
Definition: cs_Logger.h:90
uint8_t * buffer_ptr_t
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: 10 May....
Definition: cs_Typedefs.h:19
Struct with fixed length, useful when sending as payload.
Definition: cs_StackBuffer.h:29
uint16_t length
Definition: cs_StackBuffer.h:30
Struct with dynamic length, used by StackBuffer class.
Definition: cs_StackBuffer.h:20
uint16_t length
Definition: cs_StackBuffer.h:21