17 #include "LvArrayConfig.hpp" 23 #include <type_traits> 39 template<
typename T,
int LENGTH >
43 static_assert( std::is_trivially_destructible< T >::value,
"The StackBuffer can only hold trivially copyable and destructable types." );
73 template< typename _T=T, typename=std::enable_if_t< std::is_const< _T >::value > >
113 {
return const_cast< T *
>(
m_data ); }
121 template<
typename INDEX_TYPE >
124 {
return const_cast< T *
>(
m_data )[ i ]; }
#define LVARRAY_UNUSED_VARIABLE(X)
Mark X as an unused variable, used to silence compiler warnings.
Definition: Macros.hpp:79
LVARRAY_HOST_DEVICE constexpr T * data() const
Definition: StackBuffer.hpp:112
LVARRAY_HOST_DEVICE constexpr T & operator[](INDEX_TYPE const i) const
Definition: StackBuffer.hpp:123
LVARRAY_HOST_DEVICE constexpr std::ptrdiff_t capacity() const
Definition: StackBuffer.hpp:105
This class implements the default behavior for the Buffer methods related to execution space...
Definition: bufferManipulation.hpp:78
T m_data[LENGTH]
The c-array containing the values.
Definition: StackBuffer.hpp:129
#define LVARRAY_ERROR_IF_GT(lhs, rhs)
Raise a hard error if one value compares greater than the other.
Definition: Macros.hpp:392
LVARRAY_HOST_DEVICE constexpr StackBuffer(bool=true)
Constructor for creating an empty/uninitialized buffer.
Definition: StackBuffer.hpp:56
Contains functions for manipulating buffers.
static constexpr bool hasShallowCopy
Signifies that the StackBuffer's copy semantics are deep.
Definition: StackBuffer.hpp:49
camp::resources::Platform MemorySpace
an alias for camp::resources::Platform.
Definition: bufferManipulation.hpp:31
LVARRAY_HOST_DEVICE constexpr StackBuffer(StackBuffer const &src, std::ptrdiff_t)
Sized copy constructor, creates a deep copy.
Definition: StackBuffer.hpp:64
LVARRAY_HOST_DEVICE constexpr StackBuffer(StackBuffer< std::remove_const_t< T >, LENGTH > const &src)
Create a copy of src with const T.
Definition: StackBuffer.hpp:75
The top level namespace.
Definition: Array.hpp:24
T value_type
Alias used in the bufferManipulation functions.
Definition: StackBuffer.hpp:46
LVARRAY_HOST_DEVICE void reallocate(std::ptrdiff_t const size, MemorySpace const space, std::ptrdiff_t const newCapacity)
Notionally this method reallocates the buffer, but since the StackBuffer is sized at compile time all...
Definition: StackBuffer.hpp:87
Contains a bunch of macro definitions.
LVARRAY_HOST_DEVICE constexpr void free()
Free the data in the buffer but does not destroy any values.
Definition: StackBuffer.hpp:98
This class implements the Buffer interface using a c-array.
Definition: StackBuffer.hpp:40
#define LVARRAY_HOST_DEVICE
Mark a function for both host and device usage.
Definition: Macros.hpp:600