This class implements a static buffer that has a fixed capacity.
More...
#include <StaticBuffer.h>
|
typedef T | Type |
| Definition of the data type of each individual buffer element.
|
|
|
| StaticBuffer ()=default |
| Creates a new buffer object.
|
|
| StaticBuffer (const T &value) |
| Creates a new buffer object.
|
|
| StaticBuffer (T &&value) |
| Creates a new buffer object.
|
|
| StaticBuffer (const T *buffer) |
| Creates a new buffer object.
|
|
| StaticBuffer (const size_t number, const T &value) |
| Creates a new buffer object.
|
|
| StaticBuffer (const std::vector< T > &values) |
| Creates a new buffer object.
|
|
| StaticBuffer (std::vector< T > &&values) |
| Creates a new buffer object.
|
|
void | clear () |
| Clears all elements of this buffer.
|
|
const T & | front () const |
| Returns the first elements of this buffer.
|
|
T & | front () |
| Returns the first elements of this buffer.
|
|
const T & | back () const |
| Returns the last elements of this buffer.
|
|
T & | back () |
| Returns the last elements of this buffer.
|
|
const T * | data () const |
| Returns the buffer data pointer.
|
|
T * | data () |
| Returns the buffer data pointer.
|
|
const T & | operator[] (const size_t index) const |
| Returns one element of this buffer.
|
|
T & | operator[] (const size_t index) |
| Returns one element of this buffer.
|
|
bool | operator== (const StaticBuffer< T, tCapacity > &second) const |
| Returns whether two buffers are identical.
|
|
bool | operator!= (const StaticBuffer< T, tCapacity > &second) const |
| Returns whether two buffers are not identical.
|
|
|
static constexpr size_t | capacity () |
| Returns the capacity of this buffer.
|
|
|
T | elements_ [tCapacity > size_t(0) ? tCapacity :size_t(1)] |
| Elements of this buffer (with at least one entry).
|
|
template<typename T,
size_t tCapacity>
class Ocean::StaticBuffer< T, tCapacity >
This class implements a static buffer that has a fixed capacity.
- Template Parameters
-
T | Data type of the elements that will be stored |
tCapacity | Number of elements that can be stored, with range [1, infinity) |
◆ Type
template<typename T ,
size_t tCapacity>
Definition of the data type of each individual buffer element.
◆ StaticBuffer() [1/7]
template<typename T ,
size_t tCapacity>
Creates a new buffer object.
◆ StaticBuffer() [2/7]
template<typename T ,
size_t tCapacity>
Creates a new buffer object.
- Parameters
-
value | The value that will be set for the first element of this buffer |
◆ StaticBuffer() [3/7]
template<typename T ,
size_t tCapacity>
Creates a new buffer object.
- Parameters
-
value | The value that will be set for the first element of this buffer |
◆ StaticBuffer() [4/7]
template<typename T ,
size_t tCapacity>
Creates a new buffer object.
- Parameters
-
buffer | A buffer with at least as much elements as this static buffer has, all 'tCapacity' elements are copied, must be valid |
◆ StaticBuffer() [5/7]
template<typename T ,
size_t tCapacity>
Creates a new buffer object.
- Parameters
-
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 |
◆ StaticBuffer() [6/7]
template<typename T ,
size_t tCapacity>
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.
- Parameters
-
values | The values that will be used as first elements |
◆ StaticBuffer() [7/7]
template<typename T ,
size_t tCapacity>
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.
- Parameters
-
values | The values that will be used as first elements |
◆ back() [1/2]
template<typename T ,
size_t tCapacity>
Returns the last elements of this buffer.
- Returns
- Last element
◆ back() [2/2]
template<typename T ,
size_t tCapacity>
Returns the last elements of this buffer.
- Returns
- Last element
◆ capacity()
template<typename T ,
size_t tCapacity>
Returns the capacity of this buffer.
- Returns
- Buffer capacity
◆ clear()
template<typename T ,
size_t tCapacity>
Clears all elements of this buffer.
◆ data() [1/2]
template<typename T ,
size_t tCapacity>
Returns the buffer data pointer.
- Returns
- Data pointer
◆ data() [2/2]
template<typename T ,
size_t tCapacity>
Returns the buffer data pointer.
- Returns
- Data pointer
◆ front() [1/2]
template<typename T ,
size_t tCapacity>
Returns the first elements of this buffer.
- Returns
- First element
◆ front() [2/2]
template<typename T ,
size_t tCapacity>
Returns the first elements of this buffer.
- Returns
- First element
◆ operator!=()
template<typename T ,
size_t tCapacity>
Returns whether two buffers are not identical.
- Parameters
-
second | The second buffer object |
- Returns
- True, if so
◆ operator==()
template<typename T ,
size_t tCapacity>
Returns whether two buffers are identical.
- Parameters
-
second | The second buffer object |
- Returns
- True, if so
◆ operator[]() [1/2]
template<typename T ,
size_t tCapacity>
Returns one element of this buffer.
Beware: No range check is done.
- Parameters
-
index | The index of the element that will be returned, with range [0, tCapacity) |
- Returns
- Buffer element
◆ operator[]() [2/2]
template<typename T ,
size_t tCapacity>
Returns one element of this buffer.
Beware: No range check is done.
- Parameters
-
index | The index of the element that will be returned, with range [0, tCapacity) |
- Returns
- Buffer element
◆ elements_
template<typename T ,
size_t tCapacity>
Elements of this buffer (with at least one entry).
The documentation for this class was generated from the following file: