FbxAutoPtr mimics the auto_ptr class template implementation available in the C++ Standard Library.
The auto_ptr template class describes an object that stores a pointer to a single allocated object of type Type* that ensures that the object to which it points gets destroyed automatically when control leaves a scope.
Definition at line 185 of file fbxalloc.h.
#include <fbxalloc.h>
Public Member Functions | |
| FbxAutoPtr (Type *pPtr=0) | |
| Construct from a pointer. | |
| ~FbxAutoPtr () | |
| Destructor. | |
| Type * | Get () const |
| Retrieve the pointer it holds. | |
| Type * | operator-> () const |
| Member access operator. | |
| operator Type * () const | |
| Convert to a Type pointer. | |
| Type & | operator* () const |
| Dereference operator. | |
| bool | operator! () const |
| Logical not operator. | |
| operator bool () const | |
| Convert to boolean value. | |
| void | Reset (Type *pPtr=0) |
| Reset the scoped pointer by swapping with another pointer. | |
| void | Swap (FbxAutoPtr &pOther) |
| Swap with another pointer. | |
| Type * | Release () |
| Release the pointer, so that it won't perform deletion in its destruction. | |
| FbxAutoPtr | ( | Type * | pPtr = 0 | ) | [inline, explicit] |
| ~FbxAutoPtr | ( | ) | [inline] |
| Type* Get | ( | ) | const [inline] |
| Type* operator-> | ( | ) | const [inline] |
| operator Type * | ( | ) | const [inline] |
| Type& operator* | ( | ) | const [inline] |
| bool operator! | ( | ) | const [inline] |
| operator bool | ( | ) | const [inline] |
| void Reset | ( | Type * | pPtr = 0 | ) | [inline] |
Reset the scoped pointer by swapping with another pointer.
Definition at line 213 of file fbxalloc.h.
{
FBX_ASSERT(pPtr == 0 || pPtr != mPtr); //Catch self-reset errors
FbxAutoPtr<Type, Policy>(pPtr).Swap(*this);
}
| void Swap | ( | FbxAutoPtr< Type, Policy > & | pOther | ) | [inline] |
Swap with another pointer.
Definition at line 220 of file fbxalloc.h.
{
Type* TmpPtr = pOther.mPtr;
pOther.mPtr = mPtr;
mPtr = TmpPtr;
}
| Type* Release | ( | ) | [inline] |
Release the pointer, so that it won't perform deletion in its destruction.
Definition at line 228 of file fbxalloc.h.
{
Type* TmpPtr = mPtr;
mPtr = NULL;
return TmpPtr;
}