AllocatedBuffer

Array based buffer manager. Uses custom allocator to get the data. Limits growth to doubling.

Constructors

this
this(Allocator alloc)

Construct a buffer manager with a given allocator.

Members

Functions

avail
size_t avail()
capacity
size_t capacity()
extend
size_t extend(size_t request)

Add more data to the window of currently valid data. To avoid expensive reallocation, use avail to tune this call.

releaseBack
void releaseBack(size_t elements)

Give bytes back to the buffer manager from the back of the buffer. These bytes can be removed in this operation or further operations and should no longer be used.

releaseFront
void releaseFront(size_t elements)

Give bytes back to the buffer manager from the front of the buffer. These bytes can be removed in this operation or further operations and should no longer be used.

window
T[] window()

The window of currently valid data

Parameters

T

The type of the elements the buffer will use

Allocator

The allocator to use for adding more elements

floorSize

The size that can be freely allocated before growth is restricted to 2x.

Based on concept by Dmitry Olshansky

Meta