Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes

vl::Buffer Class Reference

Implements a buffer whose storage is in local memory. More...

#include <Buffer.hpp>

Inheritance diagram for vl::Buffer:
vl::Object vl::BufferObject

List of all members.

Public Types

enum  EAllocationMode { UserAllocatedBuffer, AutoAllocatedBuffer }

Public Member Functions

 Buffer ()
 Buffer (const Buffer &other)
Bufferoperator= (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

Detailed Description

Implements a buffer whose storage is in local memory.

Definition at line 46 of file Buffer.hpp.

Member Enumeration Documentation


Definition at line 51 of file Buffer.hpp.

Constructor & Destructor Documentation

vl::Buffer::Buffer (  ) [inline]
vl::Buffer::Buffer ( const Buffer other ) [inline]
vl::Buffer::~Buffer (  ) [inline]

Definition at line 114 of file Buffer.hpp.

References clear().

Member Function Documentation

Buffer& vl::Buffer::operator= ( const Buffer other ) [inline]
void vl::Buffer::swap ( Buffer other ) [inline]

Definition at line 98 of file Buffer.hpp.

References mAlignment, mByteCount, and mPtr.

void vl::Buffer::clear (  ) [inline]
void vl::Buffer::resize ( size_t  byte_count,
size_t  alignment = 0 
) [inline]
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 171 of file Buffer.hpp.

References clear(), mAlignment, mAllocationMode, mByteCount, mPtr, and UserAllocatedBuffer.

void vl::Buffer::setAllocationMode ( EAllocationMode  mode ) [inline]

Definition at line 180 of file Buffer.hpp.

References clear(), mAlignment, mAllocationMode, mByteCount, and mPtr.

EAllocationMode vl::Buffer::allocationMode (  ) const [inline]

Definition at line 193 of file Buffer.hpp.

References mAllocationMode.

size_t vl::Buffer::bytesUsed (  ) const [inline]
bool vl::Buffer::empty (  ) const [inline]

Definition at line 197 of file Buffer.hpp.

References mByteCount.

unsigned char* vl::Buffer::ptr (  ) [inline]
const unsigned char* vl::Buffer::ptr (  ) const [inline]

Definition at line 201 of file Buffer.hpp.

References mPtr.

size_t vl::Buffer::alignment (  ) const [inline]

Definition at line 203 of file Buffer.hpp.

References mAlignment.

Referenced by resize().

static void* vl::Buffer::alignedMalloc ( size_t  bytes,
size_t  alignment 
) [inline, static]

Definition at line 207 of file Buffer.hpp.

References NULL.

Referenced by resize().

static void vl::Buffer::alignedFree ( void *  ptr ) [inline, static]

Definition at line 247 of file Buffer.hpp.

References NULL.

Referenced by clear(), and resize().

Member Data Documentation

unsigned char* vl::Buffer::mPtr [protected]
size_t vl::Buffer::mByteCount [protected]
size_t vl::Buffer::mAlignment [protected]

The documentation for this class was generated from the following file:

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:06.
Permission is granted to use this page to write and publish articles regarding Visualization Library.