Difference between revisions of "DUM Handles"

From reSIProcate
Jump to navigation Jump to search
 
Line 1: Line 1:
*Handles
 
 
Usages and Handlers must not be exposed to the application, since they might get deleted by the time the application tries to use them.  Instead, the application gets a Handle to a Usage or Handler.  The Handle keeps track of the referenced object, and will throw a HandleException if the application attempts to access an object that has been deleted.  Handle:isValid() will return true if the Handled object exists, or false otherwise.  Handle::get() will return the Handled object if it still exists or throw a HandleException if it does not.  A Handle is essentially a smart pointer.
 
Usages and Handlers must not be exposed to the application, since they might get deleted by the time the application tries to use them.  Instead, the application gets a Handle to a Usage or Handler.  The Handle keeps track of the referenced object, and will throw a HandleException if the application attempts to access an object that has been deleted.  Handle:isValid() will return true if the Handled object exists, or false otherwise.  Handle::get() will return the Handled object if it still exists or throw a HandleException if it does not.  A Handle is essentially a smart pointer.

Revision as of 17:13, 15 June 2005

Usages and Handlers must not be exposed to the application, since they might get deleted by the time the application tries to use them. Instead, the application gets a Handle to a Usage or Handler. The Handle keeps track of the referenced object, and will throw a HandleException if the application attempts to access an object that has been deleted. Handle:isValid() will return true if the Handled object exists, or false otherwise. Handle::get() will return the Handled object if it still exists or throw a HandleException if it does not. A Handle is essentially a smart pointer.