Visualization LibraryA lightweight C++ OpenGL middleware for 2D/3D graphics |
[Home] [Tutorials] [All Classes] [Grouped Classes] |
Implements a buffer whose storage is in local memory. More...
#include <Buffer.hpp>
Public Types | |
| enum | EAllocationMode { UserAllocatedBuffer, AutoAllocatedBuffer } |
Public Member Functions | |
| virtual const char * | className () |
| Returns the name of the class. | |
| Buffer () | |
| Buffer (const Buffer &other) | |
| Buffer & | operator= (const Buffer &other) |
| void | swap (Buffer &other) |
| ~Buffer () | |
| void | clear () |
| void | resize (size_t byte_count, size_t alignment=0) |
| void | setUserAllocatedBuffer (void *ptr, size_t bytes) |
| Uses a user-allocated buffer as storage. | |
| void | setAllocationMode (EAllocationMode mode) |
| EAllocationMode | allocationMode () const |
| size_t | bytesUsed () const |
| bool | empty () const |
| unsigned char * | ptr () |
| const unsigned char * | ptr () const |
| size_t | alignment () const |
Static Public Member Functions | |
| static void * | alignedMalloc (size_t bytes, size_t alignment) |
| static void | alignedFree (void *ptr) |
Protected Attributes | |
| unsigned char * | mPtr |
| size_t | mByteCount |
| size_t | mAlignment |
| EAllocationMode | mAllocationMode |
Implements a buffer whose storage is in local memory.
Definition at line 46 of file Buffer.hpp.
Definition at line 49 of file Buffer.hpp.
| vl::Buffer::Buffer | ( | ) | [inline] |
Definition at line 57 of file Buffer.hpp.
References AutoAllocatedBuffer, mAlignment, mAllocationMode, mByteCount, mPtr, VL_DEBUG_SET_OBJECT_NAME, and VL_DEFAULT_BUFFER_BYTE_ALIGNMENT.
| vl::Buffer::Buffer | ( | const Buffer & | other ) | [inline] |
Definition at line 65 of file Buffer.hpp.
References AutoAllocatedBuffer, mAlignment, mAllocationMode, mByteCount, mPtr, VL_DEBUG_SET_OBJECT_NAME, and VL_DEFAULT_BUFFER_BYTE_ALIGNMENT.
| vl::Buffer::~Buffer | ( | ) | [inline] |
Definition at line 113 of file Buffer.hpp.
References clear().
| virtual const char* vl::Buffer::className | ( | ) | [inline, virtual] |
Returns the name of the class.
Reimplemented from vl::Object.
Reimplemented in vl::GLBufferObject.
Definition at line 56 of file Buffer.hpp.
Definition at line 75 of file Buffer.hpp.
References AutoAllocatedBuffer, bytesUsed(), mAlignment, mAllocationMode, mByteCount, mPtr, ptr(), resize(), and VL_CHECK.
| void vl::Buffer::swap | ( | Buffer & | other ) | [inline] |
Definition at line 97 of file Buffer.hpp.
References mAlignment, mByteCount, and mPtr.
| void vl::Buffer::clear | ( | ) | [inline] |
Definition at line 118 of file Buffer.hpp.
References alignedFree(), AutoAllocatedBuffer, mAllocationMode, mByteCount, and mPtr.
Referenced by vl::ArrayAbstract::clear(), resize(), setAllocationMode(), vl::GLBufferObject::setBufferData(), vl::GLBufferObject::setBufferSubData(), setUserAllocatedBuffer(), and ~Buffer().
| void vl::Buffer::resize | ( | size_t | byte_count, |
| size_t | alignment = 0 |
||
| ) | [inline] |
Definition at line 127 of file Buffer.hpp.
References alignedFree(), alignedMalloc(), alignment(), AutoAllocatedBuffer, clear(), mAlignment, mAllocationMode, mByteCount, vl::min(), mPtr, ptr(), and VL_CHECK.
Referenced by vl::GLBufferObject::downloadGLBufferObject(), operator=(), vl::ArrayAbstract::operator=(), and vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >::resize().
| void vl::Buffer::setUserAllocatedBuffer | ( | void * | ptr, |
| size_t | bytes | ||
| ) | [inline] |
Uses a user-allocated buffer as storage.
After calling this function any call to resize() is illegal. Calling this function enables the UserAllocatedBuffer mode. Call setAllocationMode( AutoAllocatedBuffer ) to revert to the default behaviour.
Definition at line 170 of file Buffer.hpp.
References clear(), mAlignment, mAllocationMode, mByteCount, mPtr, and UserAllocatedBuffer.
| void vl::Buffer::setAllocationMode | ( | EAllocationMode | mode ) | [inline] |
Definition at line 179 of file Buffer.hpp.
References clear(), mAlignment, mAllocationMode, mByteCount, and mPtr.
| EAllocationMode vl::Buffer::allocationMode | ( | ) | const [inline] |
Definition at line 192 of file Buffer.hpp.
References mAllocationMode.
| size_t vl::Buffer::bytesUsed | ( | ) | const [inline] |
Definition at line 194 of file Buffer.hpp.
References mByteCount.
Referenced by vl::ArrayAbstract::bytesUsed(), operator=(), vl::ArrayAbstract::operator=(), and vl::GLBufferObject::setBufferData().
| bool vl::Buffer::empty | ( | ) | const [inline] |
Definition at line 196 of file Buffer.hpp.
References mByteCount.
| unsigned char* vl::Buffer::ptr | ( | ) | [inline] |
Definition at line 198 of file Buffer.hpp.
References mPtr.
Referenced by vl::OpenGLContext::bindVAS(), vl::GLBufferObject::downloadGLBufferObject(), vl::GLBufferObject::mapGPUBuffer(), operator=(), vl::ArrayAbstract::ptr(), resize(), vl::GLBufferObject::setBufferData(), and vl::GLBufferObject::setBufferSubData().
| const unsigned char* vl::Buffer::ptr | ( | ) | const [inline] |
Definition at line 200 of file Buffer.hpp.
References mPtr.
| size_t vl::Buffer::alignment | ( | ) | const [inline] |
| static void* vl::Buffer::alignedMalloc | ( | size_t | bytes, |
| size_t | alignment | ||
| ) | [inline, static] |
Definition at line 206 of file Buffer.hpp.
Referenced by resize().
| static void vl::Buffer::alignedFree | ( | void * | ptr ) | [inline, static] |
Definition at line 246 of file Buffer.hpp.
unsigned char* vl::Buffer::mPtr [protected] |
Definition at line 262 of file Buffer.hpp.
Referenced by Buffer(), clear(), operator=(), ptr(), resize(), setAllocationMode(), setUserAllocatedBuffer(), and swap().
size_t vl::Buffer::mByteCount [protected] |
Definition at line 263 of file Buffer.hpp.
Referenced by Buffer(), bytesUsed(), clear(), empty(), operator=(), resize(), setAllocationMode(), setUserAllocatedBuffer(), and swap().
size_t vl::Buffer::mAlignment [protected] |
Definition at line 264 of file Buffer.hpp.
Referenced by alignment(), Buffer(), operator=(), resize(), setAllocationMode(), setUserAllocatedBuffer(), and swap().
EAllocationMode vl::Buffer::mAllocationMode [protected] |
Definition at line 265 of file Buffer.hpp.
Referenced by allocationMode(), Buffer(), clear(), operator=(), resize(), setAllocationMode(), and setUserAllocatedBuffer().