DUM Handles

From reSIProcate
Jump to navigation Jump to search

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.

Handles point to objects which subclass Handled, and include things like Subscriptions, InviteSessions, etc. When a Handled object is created, it registers itself with its HandleManager (which is passed to it in its constructor)...

Once created, a Handle will continue to exist even if the Handled object it refers to is deleted.


When a Handled object is created,