Scaleform::Ptr
template <class C> class Ptr;
Ptr is a template reference-counted smart pointer class that automatically calls AddRef and Release functions of its object.
GFx uses smart pointers to ensure that objects are deleted when they are no longer needed, to avoid memory leaking, and to ensure that objects are not deleted prematurely. Objects that derive from RefCountBase maintain a reference count. When an objects reference count reaches zero, the object is released. Ptr overloads certain operators in order to behave similar to a pointer, and modifies the reference count of its objects.
Please note: Reference-counted objects are created initially with a reference count of 1. Since assignment to a Ptr will increment the reference count of an object, objects must be dereferenced when initially created and assigned to smart pointers. The dereferencing will ensure that the objects reference count is not incremented in the assignment.
Ptr supports a special null pointer value of 0, indicating the absence of the object; it is initialized to the null pointer value by the default constructor.
Method |
Description |
The Ptr class destructor releases the internal object. | |
Clears the pointer to the object. | |
Obtains a pointer to the reference counted object contained by this smart pointer. | |
Obtain pointer reference directly, for D3D interfaces. | |
Initializes a new Ptr object. | |
Nulls the reference counted pointer without actually decrementing it, that is, without calling the Release function. | |
Set Assignment. | |
Picks a value. |
Operator |
Description |
Pointer dereference operator converts the object from a pointer to a reference. | |
Assigns this smart pointer to a reference-counted object. | |
Compares two smart pointers for equality. | |
Access the object that is held by the smart pointer. Returns a pointer to that object. | |
Obtains a C-style pointer to the contained object. | |
Operator overload. | |
Compares two smart pointers for inequality. |
SF_RefCount.h