This class implements the Buffer interface using a c-array.
More...
#include <StackBuffer.hpp>
|
constexpr | StackBuffer (bool=true) |
| Constructor for creating an empty/uninitialized buffer. More...
|
|
constexpr | StackBuffer (StackBuffer const &src, std::ptrdiff_t) |
| Sized copy constructor, creates a deep copy. More...
|
|
template<typename _T = T, typename = std::enable_if_t< std::is_const< _T >::value >> |
constexpr | StackBuffer (StackBuffer< std::remove_const_t< T >, LENGTH > const &src) |
| Create a copy of src with const T. More...
|
|
void | reallocate (std::ptrdiff_t const size, std::ptrdiff_t const newCapacity) |
| Notionally this method reallocates the buffer, but since the StackBuffer is sized at compile time all this does is check that newCapacity doesn't exceed LENGTH. More...
|
|
constexpr void | free () |
| Free the data in the buffer but does not destroy any values. More...
|
|
constexpr std::ptrdiff_t | capacity () const |
|
constexpr T * | data () const |
|
template<typename INDEX_TYPE > |
constexpr T & | operator[] (INDEX_TYPE const i) const |
|
void | moveNested (MemorySpace const space, std::ptrdiff_t const size, bool const touch) const |
| Move the buffer to the given execution space, optionally touching it. More...
|
|
void | move (MemorySpace const space, bool const touch) const |
| Move the buffer to the given execution space, optionally touching it. More...
|
|
void | registerTouch (MemorySpace const space) const |
| Touch the buffer in the given space. More...
|
|
template<typename = VoidBuffer> |
void | setName (std::string const &name) |
| Set the name associated with this buffer. More...
|
|
template<typename T, int LENGTH>
class LvArray::StackBuffer< T, LENGTH >
This class implements the Buffer interface using a c-array.
- Template Parameters
-
T | type of data that is contained in the buffer. T must be both trivially copyable and trivially destructable. |
LENGTH | the length of the buffer. |
- Note
- Unlike the standard Buffer classes the StackBuffer does not permit making shallow copies.
-
The parent class provides the default execution space related methods.
Definition at line 40 of file StackBuffer.hpp.
◆ StackBuffer() [1/3]
template<typename T , int LENGTH>
Constructor for creating an empty/uninitialized buffer.
- Note
- For the StackBuffer an uninitialized buffer is equivalent to an empty buffer.
Definition at line 56 of file StackBuffer.hpp.
◆ StackBuffer() [2/3]
template<typename T , int LENGTH>
Sized copy constructor, creates a deep copy.
- Parameters
-
src | The buffer to be coppied. |
Definition at line 64 of file StackBuffer.hpp.
◆ StackBuffer() [3/3]
template<typename T , int LENGTH>
template<typename _T = T, typename = std::enable_if_t< std::is_const< _T >::value >>
Create a copy of src
with const T.
- Template Parameters
-
_T | A dummy parameter to allow enable_if, do not specify. |
- Parameters
-
Definition at line 75 of file StackBuffer.hpp.
◆ capacity()
template<typename T , int LENGTH>
◆ data()
template<typename T , int LENGTH>
- Returns
- Return a pointer to the beginning of the buffer.
Definition at line 110 of file StackBuffer.hpp.
◆ free()
template<typename T , int LENGTH>
Free the data in the buffer but does not destroy any values.
- Note
- For this class this is a no-op since T must be trivially destructable.
Definition at line 96 of file StackBuffer.hpp.
◆ operator[]()
template<typename T , int LENGTH>
template<typename INDEX_TYPE >
- Template Parameters
-
INDEX_TYPE | the type used to index into the values. |
- Returns
- The value at position
i
.
- Parameters
-
i | The position of the value to access. |
- Note
- No bounds checks are performed.
Definition at line 121 of file StackBuffer.hpp.
◆ reallocate()
template<typename T , int LENGTH>
void LvArray::StackBuffer< T, LENGTH >::reallocate |
( |
std::ptrdiff_t const |
size, |
|
|
std::ptrdiff_t const |
newCapacity |
|
) |
| |
|
inline |
Notionally this method reallocates the buffer, but since the StackBuffer is sized at compile time all this does is check that newCapacity doesn't exceed LENGTH.
- Parameters
-
size | The current size of the buffer, not used. |
newCapacity | the new capacity of the buffer. |
Definition at line 86 of file StackBuffer.hpp.
The documentation for this class was generated from the following file: