Ptex
|
Smart-pointer for acquiring and releasing API objects. More...
#include <Ptexture.h>
Public Member Functions | |
PtexPtr (T *ptr=0) | |
Constructor. More... | |
~PtexPtr () | |
Destructor, calls ptr->release(). More... | |
operator T* () const | |
Use as pointer value. More... | |
T * | operator-> () const |
Access members of pointer. More... | |
T * | get () const |
Get pointer value. More... | |
void | swap (PtexPtr &p) |
Swap pointer values. More... | |
void | reset (T *ptr=0) |
Deallocate object pointed to, and optionally set to new value. More... | |
Private Member Functions | |
PtexPtr (const PtexPtr &p) | |
Copying prohibited. More... | |
void | operator= (PtexPtr &p) |
Assignment prohibited. More... | |
Private Attributes | |
T * | _ptr |
Smart-pointer for acquiring and releasing API objects.
All public API objects must be released back to the Ptex library via the release() method. This smart-pointer class can wrap any of the Ptex API objects and will automatically release the object when the pointer goes out of scope. Usage of PtexPtr is optional, but recommended.
Note: for efficiency and safety, PtexPtr is noncopyable. However, ownership can be transferred between PtexPtr instances via the PtexPtr::swap member function.
Example:
Definition at line 1045 of file Ptexture.h.
Constructor.
Definition at line 1049 of file Ptexture.h.
Destructor, calls ptr->release().
Definition at line 1052 of file Ptexture.h.
References PtexPtr< T >::_ptr.
|
inline |
Get pointer value.
Definition at line 1061 of file Ptexture.h.
References PtexPtr< T >::_ptr.
Referenced by PtexReader::getData().
|
inline |
|
inline |
Access members of pointer.
Definition at line 1058 of file Ptexture.h.
References PtexPtr< T >::_ptr.
|
inline |
Deallocate object pointed to, and optionally set to new value.
Definition at line 1072 of file Ptexture.h.
References PtexPtr< T >::_ptr.
|
private |
Definition at line 1046 of file Ptexture.h.
Referenced by PtexPtr< T >::get(), PtexPtr< T >::operator T*(), PtexPtr< T >::operator->(), PtexPtr< T >::reset(), PtexPtr< T >::swap(), and PtexPtr< T >::~PtexPtr().