Ptex
|
Smart-pointer for acquiring and releasing API objects. More...
#include <Ptexture.h>
Public Member Functions | |
PtexPtr (T *ptr=0) | |
Constructor. | |
~PtexPtr () | |
Destructor, calls ptr->release(). | |
operator T* () const | |
Use as pointer value. | |
T * | operator-> () const |
Access members of pointer. | |
T * | get () const |
Get pointer value. | |
void | swap (PtexPtr &p) |
Swap pointer values. | |
void | reset (T *ptr=0) |
Deallocate object pointed to, and optionally set to new value. | |
Private Member Functions | |
PtexPtr (const PtexPtr &p) | |
Copying prohibited. | |
void | operator= (PtexPtr &p) |
Assignment prohibited. | |
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 1032 of file Ptexture.h.
Constructor.
Definition at line 1036 of file Ptexture.h.
Destructor, calls ptr->release().
Definition at line 1039 of file Ptexture.h.
References PtexPtr< T >::_ptr.
|
inline |
Get pointer value.
Definition at line 1048 of file Ptexture.h.
References PtexPtr< T >::_ptr.
Referenced by PtexReader::getData().
|
inline |
|
inline |
Access members of pointer.
Definition at line 1045 of file Ptexture.h.
References PtexPtr< T >::_ptr.
|
inline |
Deallocate object pointed to, and optionally set to new value.
Definition at line 1059 of file Ptexture.h.
References PtexPtr< T >::_ptr.
|
private |
Definition at line 1033 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().