Public Member Functions

FbxScopedPtr< T, DeletionPolicyT > Class Template Reference

Search for all occurrences

Detailed Description

template<class T, class DeletionPolicyT = FbxDefaultDeletionPolicy<T>>
class FbxScopedPtr< T, DeletionPolicyT >

FbxScopedPtr mimics a built-in pointer except that it guarantees deletion of the object pointed to, either on destruction of the FbxScopedPtr or via an explicit Reset().

Examples:

ViewScene/SceneContext.cxx.

Definition at line 57 of file fbxscopedptr.h.

#include <fbxscopedptr.h>

List of all members.

Public Member Functions

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

Constructor & Destructor Documentation

FbxScopedPtr ( T *  p = 0 ) [inline, explicit]

Construct from a pointer.

Definition at line 71 of file fbxscopedptr.h.

: ptr(p){}
~FbxScopedPtr ( ) [inline]

Destructor.

Definition at line 74 of file fbxscopedptr.h.

    {
        DeletionPolicy::DeleteIt(&ptr);
    }

Member Function Documentation

void Reset ( T *  p = 0 ) [inline]

Reset the scoped pointer by swapping with another pointer.

Definition at line 80 of file fbxscopedptr.h.

    {
        FBX_ASSERT(p == 0 || p != ptr); // catch self-reset errors
        ThisType(p).Swap(*this);
    }
T& operator* ( ) const [inline]

Dereference operator.

Definition at line 87 of file fbxscopedptr.h.

    {
        FBX_ASSERT(ptr != 0);
        return *ptr;
    }
T* operator-> ( ) const [inline]

Member access operator.

Definition at line 94 of file fbxscopedptr.h.

    {
        FBX_ASSERT(ptr != 0);
        return ptr;
    }
T* Get ( ) const [inline]

Retrieve the pointer it holds.

Definition at line 101 of file fbxscopedptr.h.

    {
        return ptr;
    }
operator T * ( ) const [inline]

Convert to a type T pointer.

Definition at line 107 of file fbxscopedptr.h.

    {
        return ptr;
    }
operator bool ( ) const [inline]

Convert to boolean value.

Definition at line 113 of file fbxscopedptr.h.

    {
        return ptr != 0;
    }
bool operator! ( ) const [inline]

Logical not operator.

Definition at line 119 of file fbxscopedptr.h.

    {
        return ptr == 0;
    }
void Swap ( FbxScopedPtr< T, DeletionPolicyT > &  b ) [inline]

Swap with another pointer.

Definition at line 125 of file fbxscopedptr.h.

    {
        T * tmp = b.ptr;
        b.ptr = ptr;
        ptr = tmp;
    }
T* Release ( ) [inline]

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

Definition at line 133 of file fbxscopedptr.h.

    {
        T* tmp = ptr;
        ptr = NULL;

        return tmp;
    }

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