#include <IotrHandle.hh>
Public Methods | |
Handle () | |
Default constructor; creates a Handle referring to nothing. | |
operator T * () | |
Automatically convert this object into a traditional pointer to an object that may be passed in as a parameter to function or method calls. | |
T * | ptr () const |
Call HandleAsPointer() instead; return a traditional pointer to the underlying object. | |
Handle (T *t) | |
Allow EXPLICIT conversion from a (T*) to a Handle to T. | |
Handle (const Handle< T > &handle) | |
Copy constructor; creates a new Handle referring to the same object. | |
T & | operator * () |
Dereferencing operation. | |
Handle< T > & | operator= (const Handle< T > &handle) |
Assignment operator; cause this Handle to refer to the same object that handle refers to. | |
~Handle () | |
Destructor; release the object (through a call to IotrRelease()) if the object is not nil. | |
T * | operator-> () |
Send a message to, or access a data member of, the object to which this is a reference. | |
Static Public Methods | |
void | bind (Handle< T > &handle, T **obj) |
Converts a traditional pointer to a Handle, destroying the original pointer. | |
void | referTo (Handle< T > &handle, T *obj) |
Makes a Handle refer to the same object as a traditional pointer. | |
Protected Attributes | |
T * | obj |
a traditional pointer to the object being referenced. |
Use handles when you wish to keep a reference to a instance of a subclass of IotrRefCount. Do not use a handle to refer to an object passed in as a parameter to a routine, unless you intend to keep the reference after the routine has exited.
|
Copy constructor; creates a new Handle referring to the same object. Increments the reference count of the object.
|
|
Allow EXPLICIT conversion from a (T*) to a Handle to T. Implicit conversion is not allowed, because this can have subtle, unintended consequences. |
|
Dereferencing operation. Return a reference to the object. |
|
Automatically convert this object into a traditional pointer to an object that may be passed in as a parameter to function or method calls. For most other purposes Handle::ptr() is more appropriate |
|
Assignment operator; cause this Handle to refer to the same object that handle refers to.
|
|
Makes a Handle refer to the same object as a traditional pointer. It is preferable to call HandleReferTo() instead of this method. |