Buffer

Just a simple generic circular buffer. Should fulfill the needs of most simple delaying tasks.

Members

Functions

read
T read()

Gets the element from the buffer at the current read index, and increments the read index.

setSize
void setSize(const size_t size)

Resize the buffer. If the new size is larger than the max size, the buffer will be reallocated so that size is the new maximum size. It is very inefficient to delete and allocate large amounts of memory like this so it is recommended to give the buffer an initial max size that will never be exceeded.

write
void write(const T element)

Assign the buffer element at the current write index to element and increment the write index.

Meta