Visual Computing Library
Loading...
Searching...
No Matches
vcl::GenericBuffer< BufferHandleType > Class Template Reference

The GenericBuffer manages the lifetime of a bgfx BufferHandle. More...

#include <vclib/bgfx/buffers/generic_buffer.h>

Public Member Functions

bool isValid () const
 Check if the Buffer is valid.
 
void destroy ()
 Destroy the Buffer.
 

Protected Member Functions

 GenericBuffer ()=default
 Empty constructor.
 
 GenericBuffer (const GenericBuffer &other)=delete
 
 GenericBuffer (GenericBuffer &&other) noexcept
 Move constructor.
 
 ~GenericBuffer ()
 Destructor.
 
GenericBufferoperator= (const GenericBuffer &other)=delete
 
GenericBufferoperator= (GenericBuffer &&other) noexcept
 Move assignment operator.
 
void swap (GenericBuffer &other)
 Swap the content of this object with another Buffer object.
 

Static Protected Member Functions

static uint64_t flagsForAccess (bgfx::Access::Enum access)
 
static bgfx::AttribType::Enum attributeType (PrimitiveType type)
 
static uint64_t flagsForType (PrimitiveType type)
 

Protected Attributes

BufferHandleType mHandle = BGFX_INVALID_HANDLE
 

Friends

void swap (GenericBuffer &a, GenericBuffer &b)
 

Detailed Description

template<typename BufferHandleType>
class vcl::GenericBuffer< BufferHandleType >

The GenericBuffer manages the lifetime of a bgfx BufferHandle.

Note
A bgfx Buffer can be moved but not copied (a copy would require to create a new Buffer Handle, that can be done only having access to the data). Any class that contains a GenericBuffer (or a derived class) should implement the copy constructor and the copy assignment operator.

Constructor & Destructor Documentation

◆ GenericBuffer() [1/2]

vcl::GenericBuffer< BufferHandleType >::GenericBuffer ( )
protecteddefault

Empty constructor.

It creates an invalid GenericBuffer object.

◆ GenericBuffer() [2/2]

vcl::GenericBuffer< BufferHandleType >::GenericBuffer ( GenericBuffer< BufferHandleType > &&  other)
inlineprotectednoexcept

Move constructor.

The other GenericBuffer is left in an invalid state.

Parameters
[in]otherthe other GenericBuffer object.

◆ ~GenericBuffer()

Destructor.

If the GenericBuffer is valid, the bgfx Buffer Handle is destroyed.

Member Function Documentation

◆ isValid()

bool vcl::GenericBuffer< BufferHandleType >::isValid ( ) const
inline

Check if the Buffer is valid.

Returns
true if the Buffer is valid, false otherwise.

◆ operator=()

GenericBuffer & vcl::GenericBuffer< BufferHandleType >::operator= ( GenericBuffer< BufferHandleType > &&  other)
inlineprotectednoexcept

Move assignment operator.

The other GenericBuffer is left in an invalid state.

Parameters
[in]otherthe other GenericBuffer object.
Returns
a reference to this object.

◆ swap()

Swap the content of this object with another Buffer object.

Parameters
[in]otherthe other Buffer object.

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