A view over data. More...
Public Member Functions | |
BufferView () noexcept | |
BufferView (T *data, unsigned long long size) noexcept | |
BufferView (const Buffer &buffer) noexcept | |
BufferView (const Buffer &buffer, unsigned long long index, unsigned long long length=0) noexcept | |
BufferView (Buffer &&buffer)=delete | |
T * | getData () const |
unsigned long long | getSize () const |
bool | empty () const |
T & | front () |
const T & | front () const |
T & | back () |
const T & | back () const |
T * | begin () |
const T * | begin () const |
T * | end () |
const T * | end () const |
BufferView< T > | subView (unsigned long long index, unsigned long long length=0) const |
T & | operator[] (unsigned long long index) |
const T & | operator[] (unsigned long long index) const |
BufferView< T > & | operator= (const BufferView< T > &other) noexcept |
BufferView< T > & | operator= (BufferView< T > &&other) noexcept |
template<typename U > | |
BufferView (const BufferCast< U > &bufferCast) noexcept | |
BufferView (const BufferCast< T > &bufferCast) noexcept | |
template<typename U > | |
BufferView (const BufferView< U > &view) noexcept | |
BufferView (const BufferView< T > &view) noexcept | |
BufferView (BufferView< T > &&other) noexcept | |
template<typename U , std::size_t S> | |
BufferView (std::array< U, S > &array) noexcept | |
template<std::size_t S> | |
BufferView (std::array< T, S > &array) noexcept | |
template<typename U > | |
BufferView (std::vector< U > &vec) noexcept | |
BufferView (std::vector< T > &vec) noexcept | |
template<typename U , std::size_t S, typename = std::enable_if<std::is_const<T>::value>> | |
BufferView (const std::array< U, S > &array) noexcept | |
template<std::size_t S, typename = std::enable_if<std::is_const<T>::value>> | |
BufferView (const std::array< typename std::remove_const< T >::type, S > &array) noexcept | |
template<typename U , typename = std::enable_if<std::is_const<T>::value>> | |
BufferView (const std::vector< U > &vec) noexcept | |
template<typename = std::enable_if<std::is_const<T>::value>> | |
BufferView (const std::vector< typename std::remove_const< T >::type > &vec) noexcept | |
operator Buffer () const | |
template<typename U = T> | |
operator BufferCast< U > () const | |
A view over data.
Behaves like the BufferCast, but not considered as owner of the memory. This means this variant of the buffer is a good candidate when exchanging data, as it doesn't copy anything but only offers a view over it.
It also allows to cast the data, and alter the way it is intepreted.
|
noexcept |
Default constructor. Creates an empty view.
|
noexcept |
Raw data constructor. This will make the view point to the data provided.
data | The data to point to. |
size | The size of the data provided. |
|
noexcept |
Buffer constructor. Offers a view over the data of a buffer.
buffer | The buffer which memory has to be pointed. |
|
noexcept |
Buffer sub-part constructor. Offers a view over a sub-part of a buffer.
buffer | The buffer which memory has to be pointed. |
index | The starting offset, in number of elements T, at which the view should start. |
length | The number of elements T the sub-view should have. |
|
delete |
This destructor is deleted, as a Buffer&& will clean up its memory right after assignment. This is unsafe as the new view's memory will be invalid.
buffer | The rvalue buffer. |
|
noexcept |
Utility constructor over casts of different type.
bufferCast | The buffer cast which data should be pointed. |
|
noexcept |
Utility constructor over casts of the same type.
bufferCast | The buffer cast which data should be pointed. |
|
noexcept |
Utility constructor over a view of another type, reinterpreting the data.
view | The view to reinterpret. |
|
noexcept |
Utility copy constructor.
view | The view to copy. |
|
noexcept |
Move constructor.
other | The view to move over. |
|
noexcept |
Utility constructor over an array which memory will be reinterpreted to another type.
array | The array which data should be referenced. |
|
noexcept |
Utility constructor over an array.
array | The array which data should be referenced. |
|
noexcept |
Utility constructor over a vector which memory will be reinterpreted to another type.
vec | The vector which data should be reinterpreted. |
|
noexcept |
Utility constructor over vectors.
vec | The vector which data should be referenced. |
|
noexcept |
Utility reinterpreting constructor over a const array.
array | The array which data should be reinterpreted. |
|
noexcept |
Utility reinterpreting constructor over a const array.
array | The array which data should be referenced. |
|
noexcept |
Utility reinterpreting constructor over a const vector.
vec | The vector which data should be reinterpreted. |
|
noexcept |
Utility vector constructor, const version.
vec | The vector which data should be referenced. |
T* nkMemory::BufferView< T >::getData | ( | ) | const |
unsigned long long nkMemory::BufferView< T >::getSize | ( | ) | const |
bool nkMemory::BufferView< T >::empty | ( | ) | const |
T& nkMemory::BufferView< T >::front | ( | ) |
const T& nkMemory::BufferView< T >::front | ( | ) | const |
T& nkMemory::BufferView< T >::back | ( | ) |
const T& nkMemory::BufferView< T >::back | ( | ) | const |
T* nkMemory::BufferView< T >::begin | ( | ) |
const T* nkMemory::BufferView< T >::begin | ( | ) | const |
T* nkMemory::BufferView< T >::end | ( | ) |
const T* nkMemory::BufferView< T >::end | ( | ) | const |
BufferView<T> nkMemory::BufferView< T >::subView | ( | unsigned long long | index, |
unsigned long long | length = 0 |
||
) | const |
Allows to create a view over a subpart of current view.
index | The new view's starting element's index. |
length | The new view's length, from starting element. If 0, it will default to current view's ending point. |
T& nkMemory::BufferView< T >::operator[] | ( | unsigned long long | index | ) |
Indexing operator.
index | The index of the element to index in the memory. |
const T& nkMemory::BufferView< T >::operator[] | ( | unsigned long long | index | ) | const |
Indexing operator, const versioned.
index | The index of the element to index in the memory. |
|
noexcept |
Copy assignment operator.
other | The view to copy over. |
|
noexcept |
Move assignment operator.
other | The view to move over. |
nkMemory::BufferView< T >::operator Buffer | ( | ) | const |
Automatic conversion operator to a binary Buffer. This operation will copy the content as-is, in a binary fashion.
nkMemory::BufferView< T >::operator BufferCast< U > | ( | ) | const |
Automatic conversion operator to a buffer cast of the same type. This operation will copy the content as-is, ready to be interprated as it was.