OGRE-Next
3.0.0
Object-Oriented Graphics Rendering Engine
|
Helper class to that will free the pointer on the destructor. More...
#include <OgreBufferPacked.h>
Public Member Functions | |
FreeOnDestructor (void *_ptr) | |
~FreeOnDestructor () | |
Public Attributes | |
void * | ptr |
Helper class to that will free the pointer on the destructor.
Usage: FreeOnDestructor dataPtrContainer( data ); vaoManager->createVertexBuffer( vertexElements, vertexCount, mVertexBufferDefaultType, data, keepAsShadow );
if( !keepAsShadow ) dataPtrContainer.ptr = 0;
In this example, "data" wouln't normally be freed if createVertexBuffer raises an exception according to BufferPacked's constructor rules, but thanks to FreeOnDestructor, the pointer will be freed accordingly. Once the BufferPacked has been created, we need to zero the ptr member to avoid freeing it (since BufferPacked will do it).
|
inline |
|
inline |
References Ogre::MEMCATEGORY_GEOMETRY, OGRE_FREE_SIMD, and ptr.
void* Ogre::FreeOnDestructor::ptr |
Referenced by ~FreeOnDestructor().