QuantumLibrary
|
Container which allows buffered access to a series of values. Values are pushed-in (written) by a producer(s) and pulled-out (read) by a consumer(s). More...
#include <quantum_buffer.h>
Public Types | |
using | ValueType = T |
Type definition for the contained value. More... | |
Public Member Functions | |
Buffer (const ALLOCATOR &alloc=ALLOCATOR()) | |
Constructor. More... | |
template<class V = T> | |
BufferStatus | push (V &&value) |
Pushes a value at the end of the buffer. This increases the size of the buffer by one. More... | |
BufferStatus | pull (T &value) |
Pulls the next value from the buffer. This decreases the size of the buffer by one. More... | |
void | close () |
Close the buffer. Once this method is called, push operations are no longer permitted. Pull operations are permitted until the buffer empties. More... | |
bool | isClosed () const |
Indicates if the buffer is closed. More... | |
size_t | size () const |
Indicates the number of values stored in the buffer. More... | |
bool | empty () const |
Helper function equivalent to size() == 0;. More... | |
Container which allows buffered access to a series of values. Values are pushed-in (written) by a producer(s) and pulled-out (read) by a consumer(s).
T | Type of the contained value. |
using Bloomberg::quantum::Buffer< T, ALLOCATOR >::ValueType = T |
Type definition for the contained value.
Bloomberg::quantum::Buffer< T, ALLOCATOR >::Buffer | ( | const ALLOCATOR & | alloc = ALLOCATOR() | ) |
Constructor.
void Bloomberg::quantum::Buffer< T, ALLOCATOR >::close | ( | ) |
Close the buffer. Once this method is called, push operations are no longer permitted. Pull operations are permitted until the buffer empties.
bool Bloomberg::quantum::Buffer< T, ALLOCATOR >::empty | ( | ) | const |
Helper function equivalent to size() == 0;.
bool Bloomberg::quantum::Buffer< T, ALLOCATOR >::isClosed | ( | ) | const |
Indicates if the buffer is closed.
BufferStatus Bloomberg::quantum::Buffer< T, ALLOCATOR >::pull | ( | T & | value | ) |
Pulls the next value from the buffer. This decreases the size of the buffer by one.
[out] | value | Reference to the variable which will contain the next valid value if return value is 'DataReceived'. |
BufferStatus Bloomberg::quantum::Buffer< T, ALLOCATOR >::push | ( | V && | value | ) |
Pushes a value at the end of the buffer. This increases the size of the buffer by one.
V | Type of the contained value. Must be inferred and always equal to T. |
[in] | value | Value pushed into the buffer |
size_t Bloomberg::quantum::Buffer< T, ALLOCATOR >::size | ( | ) | const |
Indicates the number of values stored in the buffer.