Cogs.Core
|
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.
Definition at line 159 of file IBuffers.h.
|
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. |
Definition at line 168 of file IBuffers.h.
References Cogs::IContext::map().
|
inline |
Destructs the mapped buffer.
If the buffer was successfully mapped, it will be unmapped.
Definition at line 182 of file IBuffers.h.
References Cogs::IContext::unmap().
|
inline |
Get the raw pointer to the mapped data.
Definition at line 194 of file IBuffers.h.
|
inline |
Get the stride of the mapped resource in bytes.
Definition at line 257 of file IBuffers.h.
|
inlineexplicit |
Boolean conversion operator provided to allow pointer-like semantics when checking the validity of the mapped data.
Definition at line 224 of file IBuffers.h.
|
inline |
Implicit cast to mapped data type to allow passing the mapped structure to methods expecting a raw pointer.
Definition at line 209 of file IBuffers.h.
|
inline |
Pointer operator to allow using the mapped structure as if it was a raw pointer to the data.
Definition at line 200 of file IBuffers.h.
|
inline |
Const overload of pointer operator.
Definition at line 203 of file IBuffers.h.
|
inline |
Indexing operator provided to perform optional boundary checks on the mapped data.
index | Index of the element in the array to access. |
Definition at line 232 of file IBuffers.h.
|
inline |
Indexing operator provided to perform optional boundary checks on the mapped data.
index | Index of the element in the array to access. |
Definition at line 247 of file IBuffers.h.
|
private |
Definition at line 261 of file IBuffers.h.
|
private |
Definition at line 260 of file IBuffers.h.
|
private |
Definition at line 262 of file IBuffers.h.
|
private |
Definition at line 263 of file IBuffers.h.
|
private |
Definition at line 264 of file IBuffers.h.