Cogs.Rendering
|
Provides RAII style mapping of a buffer resource. More...
#include <IBuffers.h>
Public Member Functions | |
MappedBuffer (struct IContext *context, BufferHandle bufferHandle, MapMode::EMapMode mapMode=MapMode::Read, size_t size=0) | |
Constructs a mapped buffer, initializing the mapped contents from the context and buffer handle given. | |
MappedBuffer (const MappedBuffer &other)=delete | |
Deleted copy constructor. | |
~MappedBuffer () | |
Destructs the mapped buffer. | |
MappedDataType * | get () |
Get the raw pointer to the mapped data. | |
MappedDataType * | operator-> () |
Pointer operator to allow using the mapped structure as if it was a raw pointer to the data. | |
const MappedDataType * | operator-> () const |
Const overload of pointer operator. | |
operator MappedDataType * () | |
Implicit cast to mapped data type to allow passing the mapped structure to methods expecting a raw pointer. | |
operator bool () const | |
Boolean conversion operator provided to allow pointer-like semantics when checking the validity of the mapped data. | |
MappedDataType & | operator[] (size_t index) |
Indexing operator provided to perform optional boundary checks on the mapped data. | |
const MappedDataType & | operator[] (size_t index) const |
Indexing operator provided to perform optional boundary checks on the mapped data. | |
uint32_t | getStride () const |
Get the stride of the mapped resource in bytes. | |
Private Attributes | |
struct IContext * | context = nullptr |
BufferHandle | bufferHandle |
MappedDataType * | data = nullptr |
size_t | size = 0 |
uint32_t | stride = 0 |
Provides RAII style mapping of a buffer resource.
|
inline |
Constructs a mapped buffer, initializing the mapped contents from the context and buffer handle given.
context | Pointer to the current graphics context. |
bufferHandle | Handle to the buffer to map data from. |
mapMode | Mode to map the buffer in. |
References Cogs::MappedBuffer< MappedDataType >::bufferHandle, Cogs::MappedBuffer< MappedDataType >::context, Cogs::MappedBuffer< MappedDataType >::data, Cogs::IContext::map(), and Cogs::MappedBuffer< MappedDataType >::stride.
|
delete |
Deleted copy constructor.
|
inline |
Destructs the mapped buffer.
If the buffer was successfully mapped, it will be unmapped.
References Cogs::MappedBuffer< MappedDataType >::bufferHandle, Cogs::MappedBuffer< MappedDataType >::context, Cogs::MappedBuffer< MappedDataType >::data, and Cogs::IContext::unmap().
|
inline |
Get the raw pointer to the mapped data.
References Cogs::MappedBuffer< MappedDataType >::data.
|
inline |
Get the stride of the mapped resource in bytes.
References Cogs::MappedBuffer< MappedDataType >::stride.
|
inlineexplicit |
Boolean conversion operator provided to allow pointer-like semantics when checking the validity of the mapped data.
References Cogs::MappedBuffer< MappedDataType >::data.
|
inline |
Implicit cast to mapped data type to allow passing the mapped structure to methods expecting a raw pointer.
References Cogs::MappedBuffer< MappedDataType >::data.
|
inline |
Pointer operator to allow using the mapped structure as if it was a raw pointer to the data.
References Cogs::MappedBuffer< MappedDataType >::data.
|
inline |
Const overload of pointer operator.
References Cogs::MappedBuffer< MappedDataType >::data.
|
inline |
Indexing operator provided to perform optional boundary checks on the mapped data.
index | Index of the element in the array to access. |
References Cogs::MappedBuffer< MappedDataType >::data, and Cogs::MappedBuffer< MappedDataType >::size.
|
inline |
Indexing operator provided to perform optional boundary checks on the mapped data.
index | Index of the element in the array to access. |
References Cogs::MappedBuffer< MappedDataType >::data, and Cogs::MappedBuffer< MappedDataType >::size.
|
private |
|
private |
|
private |
Referenced by Cogs::MappedBuffer< MappedDataType >::get(), Cogs::MappedBuffer< MappedDataType >::MappedBuffer(), Cogs::MappedBuffer< MappedDataType >::operator bool(), Cogs::MappedBuffer< MappedDataType >::operator MappedDataType *(), Cogs::MappedBuffer< MappedDataType >::operator->(), Cogs::MappedBuffer< MappedDataType >::operator[](), and Cogs::MappedBuffer< MappedDataType >::~MappedBuffer().
|
private |
Referenced by Cogs::MappedBuffer< MappedDataType >::operator[]().
|
private |