Smart pointer to a CGUIObject which will automatically be set to NULL if the corresponding GUIObject gets destructed. More...
#include <SafeGUIObjectPtr.h>
Public Member Functions | |
CSafeGUIObjectPtr () | |
CSafeGUIObjectPtr (CGUIObject *ptr) | |
CSafeGUIObjectPtr (const CSafeGUIObjectPtr &ptr) | |
~CSafeGUIObjectPtr () | |
CGUIObject * | get () const |
operator CGUIObject * () const | |
CGUIObject & | operator* () const |
CGUIObject * | operator-> () const |
CSafeGUIObjectPtr & | operator= (CGUIObject *pkSource) |
CSafeGUIObjectPtr & | operator= (const CSafeGUIObjectPtr &kSource) |
void | Register () |
void | Reset () |
Helper function to reset internal pointer. | |
Friends | |
class | CGUIObject |
Smart pointer to a CGUIObject which will automatically be set to NULL if the corresponding GUIObject gets destructed.
This class is useful if you are accessing an object which is not under your sole control, i.e. it could be deleted by other code, rendering your local pointer invalid.
Warning: You shall not instantiate objects of this class as members of static classes, since CSafeGUIObjectPtr requires the framework to be fully initialized!
Performance note: Compared to a plain GUIObject* this class will impose a performance overhead, so use it sparingly and stick with simple CGUIObject-pointers when possible!
Example:
|
inline |
Default constructor
|
inline |
Constructor
ptr | Source pointer |
|
inline |
Constructor
ptr | Source pointer |
|
inline |
Destructor
|
inline |
Extract pointer
|
inline |
Cast operator to CGUIObject*
|
inline |
Dereference operator
|
inline |
Arrow operator
|
inline |
Assignment operator
pkSource | Source of assignment as a CGUIObject* |
|
inline |
Assignment operator
kSource | Source of assignment as a CSafeGUIObjectPtr |
|
inline |
Registers this CSafeGUIObjectPtr for being notified if its referenced object gets destructed. This is automatically done during CSafeGUIObjectPtr's construction and only needs to be done manually in case an object of CSafeGUIObjectPtr could not successfully register itself upon construction.
|
friend |