FBX C++ API Reference
FbxAutoPtr< Type, Policy > Class Template Reference

FbxAutoPtr mimics the auto_ptr class template implementation available in the C++ Standard Library. More...

#include <fbxalloc.h>

Public Member Functions

 FbxAutoPtr (Type *pPtr=0)
 Construct from a pointer. More...
 
 ~FbxAutoPtr ()
 Destructor. More...
 
Type * Get () const
 Retrieve the pointer it holds. More...
 
Type * operator-> () const
 Member access operator. More...
 
 operator Type * () const
 Convert to a Type pointer. More...
 
Type & operator* () const
 Dereference operator. More...
 
bool operator! () const
 Logical not operator. More...
 
 operator bool () const
 Convert to boolean value. More...
 
void Reset (Type *pPtr=0)
 Reset the scoped pointer by swapping with another pointer. More...
 
void Swap (FbxAutoPtr &pOther)
 Swap with another pointer. More...
 
Type * Release ()
 Release the pointer, so that it won't perform deletion in its destruction. More...
 

Detailed Description

template<class Type, class Policy = FbxDeletionPolicyDefault<Type>>
class FbxAutoPtr< Type, Policy >

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.

Examples:
ViewScene/SceneContext.cxx.

Definition at line 206 of file fbxalloc.h.

Constructor & Destructor Documentation

FbxAutoPtr ( Type *  pPtr = 0)
inlineexplicit

Construct from a pointer.

Definition at line 210 of file fbxalloc.h.

210 : mPtr(pPtr){}
~FbxAutoPtr ( )
inline

Destructor.

Definition at line 213 of file fbxalloc.h.

213 { Policy::DeleteIt(&mPtr); }

Member Function Documentation

Type* Get ( ) const
inline

Retrieve the pointer it holds.

Definition at line 216 of file fbxalloc.h.

216 { return mPtr; }
Type* operator-> ( ) const
inline

Member access operator.

Definition at line 219 of file fbxalloc.h.

219 { return mPtr; }
operator Type * ( ) const
inline

Convert to a Type pointer.

Definition at line 222 of file fbxalloc.h.

222 { return mPtr; }
Type& operator* ( ) const
inline

Dereference operator.

Definition at line 225 of file fbxalloc.h.

225 { return *mPtr; }
bool operator! ( ) const
inline

Logical not operator.

Definition at line 228 of file fbxalloc.h.

228 { return mPtr == 0; }
operator bool ( ) const
inline

Convert to boolean value.

Definition at line 231 of file fbxalloc.h.

231 { return mPtr != 0; }
void Reset ( Type *  pPtr = 0)
inline

Reset the scoped pointer by swapping with another pointer.

Definition at line 234 of file fbxalloc.h.

235  {
236  FBX_ASSERT(pPtr == 0 || pPtr != mPtr); //Catch self-reset errors
237  FbxAutoPtr<Type, Policy>(pPtr).Swap(*this);
238  }
FbxAutoPtr mimics the auto_ptr class template implementation available in the C++ Standard Library...
Definition: fbxalloc.h:206
void Swap(FbxAutoPtr &pOther)
Swap with another pointer.
Definition: fbxalloc.h:241
void Swap ( FbxAutoPtr< Type, Policy > &  pOther)
inline

Swap with another pointer.

Definition at line 241 of file fbxalloc.h.

242  {
243  Type* TmpPtr = pOther.mPtr;
244  pOther.mPtr = mPtr;
245  mPtr = TmpPtr;
246  }
Type* Release ( )
inline

Release the pointer, so that it won't perform deletion in its destruction.

Definition at line 249 of file fbxalloc.h.

250  {
251  Type* TmpPtr = mPtr;
252  mPtr = NULL;
253  return TmpPtr;
254  }
#define NULL
Definition: fbxarch.h:213

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