AdaCL: Ada Class Library — smart pointer.
More...Pointer |
Object |
Create (renaming) | |
Exist (renaming) | |
Get (renaming) | |
Release (renaming) | |
Reset (renaming) | |
Swap (renaming) |
Delegate (generic instantiation) | |
Deleter (generic instantiation) |
Smart pointer with handover mechanism. Only one Unique pointer points to the referenced access. The referenced element is deleted when the unique pointer is deleted. At handover the original is set null. Simplified version which only need the element type Element_Type the element which are handled by the pointer
39 | type Pointer is access Element_Type; |
---|
45 | subtype Object is Delegate.Object; |
---|
52 | function Create (Referent : in Pointer := null) return Object renames Delegate.Create; |
---|
Creates a new unique smart pointer from normal pointer.
Pointer to reference counted object
1 | New smart pointer |
---|
59 | function Exist (This : in Object) return Boolean renames Delegate.Exist; |
---|
Checks if a pointers is set
Object itself.
1 | true when pointer is not null |
---|
66 | function Get (This : in Object) return not null Pointer renames Delegate.Get; |
---|
gets pointer to element to perform operations on. Do not save the pointer.
Object itself.
1 | pointer to element |
---|
73 | procedure Release (This : in out Object; Referent : out not null Pointer) renames Delegate.Release; |
---|
gets pointer to element and releases ownership. You cans save this pointer.
Object itself.
pointer to element
80 | procedure Reset (This : in out Object; Referent : in Pointer := null) renames Delegate.Reset; |
---|
Replaces the managed object.
Object itself.
new pointer to manage
87 | procedure Swap (This : in out Object; Other : in out Object) renames Delegate.Swap; |
---|
swaps the managed objects
Object itself.
Object to swap Referents with
43 | package Delegate is new AdaCL.Pointer.Unique_With_Delete (Element_Type => Element_Type, Pointer => Pointer); |
---|
Instantiation of AdaCL.Pointer.Unique_With_Delete
41 | procedure Deleter is new Ada.Unchecked_Deallocation (Object => Element_Type, Name => Pointer); |
---|