-
-
Notifications
You must be signed in to change notification settings - Fork 33
dlib.core.ownership
Timur Gafarov edited this page Feb 22, 2018
·
4 revisions
Object ownership system similar to Delphi's. All classes deriving from Owner
can store references to objects implementing Owned
interface (and other Owner
objects as well). When an owner is deleted, its owned objects are also deleted.
This module is not compatible with GC-collected objects. It can be used only with dlib.core.memory. Using it with objects allocated any other way will cause application to crash.
An empty interface that is used to mark objects that can be owned.
Base owner class.
-
this(Owner owner)
- base constructor.owner
is an owner for this object. It can benull
, in this case object won't have an owner. Such objects are called root owners and should be deleted manually. -
void addOwnedObject(Owned obj)
- adds owned object. -
void clearOwnedObjects()
- deletes owned objects without deleting owner itself