Ocean
|
This class implements a static buffer that has a fixed capacity. More...
Public Types | |
typedef T | Type |
Definition of the data type of each individual buffer element. More... | |
Public Member Functions | |
StaticBuffer ()=default | |
Creates a new buffer object. More... | |
StaticBuffer (const T &value) | |
Creates a new buffer object. More... | |
StaticBuffer (T &&value) | |
Creates a new buffer object. More... | |
StaticBuffer (const T *buffer) | |
Creates a new buffer object. More... | |
StaticBuffer (const size_t number, const T &value) | |
Creates a new buffer object. More... | |
StaticBuffer (const std::vector< T > &values) | |
Creates a new buffer object. More... | |
StaticBuffer (std::vector< T > &&values) | |
Creates a new buffer object. More... | |
void | clear () |
Clears all elements of this buffer. More... | |
const T & | front () const |
Returns the first elements of this buffer. More... | |
T & | front () |
Returns the first elements of this buffer. More... | |
const T & | back () const |
Returns the last elements of this buffer. More... | |
T & | back () |
Returns the last elements of this buffer. More... | |
const T * | data () const |
Returns the buffer data pointer. More... | |
T * | data () |
Returns the buffer data pointer. More... | |
const T & | operator[] (const size_t index) const |
Returns one element of this buffer. More... | |
T & | operator[] (const size_t index) |
Returns one element of this buffer. More... | |
bool | operator== (const StaticBuffer< T, tCapacity > &second) const |
Returns whether two buffers are identical. More... | |
bool | operator!= (const StaticBuffer< T, tCapacity > &second) const |
Returns whether two buffers are not identical. More... | |
Static Public Member Functions | |
static constexpr size_t | capacity () |
Returns the capacity of this buffer. More... | |
Protected Attributes | |
T | elements_ [tCapacity > size_t(0) ? tCapacity :size_t(1)] |
Elements of this buffer (with at least one entry). More... | |
This class implements a static buffer that has a fixed capacity.
T | Data type of the elements that will be stored |
tCapacity | Number of elements that can be stored, with range [1, infinity) |
typedef T Ocean::StaticBuffer< T, tCapacity >::Type |
Definition of the data type of each individual buffer element.
|
default |
Creates a new buffer object.
|
inlineexplicit |
Creates a new buffer object.
value | The value that will be set for the first element of this buffer |
|
inlineexplicit |
Creates a new buffer object.
value | The value that will be set for the first element of this buffer |
|
inlineexplicit |
Creates a new buffer object.
buffer | A buffer with at least as much elements as this static buffer has, all 'tCapacity' elements are copied, must be valid |
|
inline |
Creates a new buffer object.
number | The number of elements to be created, with range [0, tCapacity] |
value | The value that will be created in the first 'number' elements of this buffer |
|
inlineexplicit |
Creates a new buffer object.
This constructor converts a stl vector object to a static buffer object.
Only the first tCapacity elements of the given vector are copied.
values | The values that will be used as first elements |
|
inlineexplicit |
Creates a new buffer object.
This constructor converts a stl vector object to a static buffer object.
Only the first tCapacity elements of the given vector are copied.
values | The values that will be used as first elements |
|
inline |
Returns the last elements of this buffer.
|
inline |
Returns the last elements of this buffer.
|
staticconstexpr |
Returns the capacity of this buffer.
|
inline |
Clears all elements of this buffer.
|
inline |
Returns the buffer data pointer.
|
inline |
Returns the buffer data pointer.
|
inline |
Returns the first elements of this buffer.
|
inline |
Returns the first elements of this buffer.
|
inline |
Returns whether two buffers are not identical.
second | The second buffer object |
|
inline |
Returns whether two buffers are identical.
second | The second buffer object |
|
inline |
Returns one element of this buffer.
Beware: No range check is done.
index | The index of the element that will be returned, with range [0, tCapacity) |
|
inline |
Returns one element of this buffer.
Beware: No range check is done.
index | The index of the element that will be returned, with range [0, tCapacity) |
|
protected |
Elements of this buffer (with at least one entry).