OEBoundedBuffer

template<class T>
class OEBoundedBuffer

First-in-first-out (FIFO) queue that only allows for maxsize items to be stored in the buffer, hence, “bounded”. It is not inherently thread safe by itself. Use this in conjunction with a OEProtectedBuffer to make a thread-safe queue.

Constructors

OEBoundedBuffer(oesize_t maxsize)

Determines the maximum number of elements this queue can hold. The maxsize parameter should be a power-of-2 to allow for a more efficient implementation.

Empty

bool Empty() const

Returns whether the queue contains any items.

Full

bool Full() const

Returns true if the queue contains maxsize items.

Get

T Get()

Pops the next item off of the queue.

Peek

T Peek()

Returns the item that will be returned by the next call to OEBoundedBuffer.Get, but does not remove it from the queue.

Put

void Put(T obj)

Pushes an item into the queue.

Size

oesize_t Size() const

Returns the current number of items in the queue.