OGRE
2.2.4
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 |
Referenced by ~FreeOnDestructor().
|
inline |
References FreeOnDestructor(), Ogre::MEMCATEGORY_GEOMETRY, and OGRE_FREE_SIMD.
void* Ogre::FreeOnDestructor::ptr |