AdaCL.Pointer.Unique

AdaCL: Ada Class Library — smart pointer.

More...

Entities

Access types

Pointer

Record types

Object

Subprograms

Create (renaming)
Exist (renaming)
Get (renaming)
Release (renaming)
Reset (renaming)
Swap (renaming)

Generic instantiations

Delegate (generic instantiation)
Deleter (generic instantiation)

Description

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

Pointer [source]

39 type Pointer is access Element_Type;

Object [source]

45 subtype Object is Delegate.Object;

Create (renaming) [source]

52 function Create (Referent : in Pointer := null) return Object renames Delegate.Create;

Creates a new unique smart pointer from normal pointer.

Referent of type AdaCL.Pointer.Unique.Pointer

Pointer to reference counted object

1New smart pointer

Exist (renaming) [source]

59 function Exist (This : in Object) return Boolean renames Delegate.Exist;

Checks if a pointers is set

This of type AdaCL.Pointer.Unique.Object

Object itself.

1true when pointer is not null

Get (renaming) [source]

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.

This of type AdaCL.Pointer.Unique.Object

Object itself.

1pointer to element

Release (renaming) [source]

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.

This of type AdaCL.Pointer.Unique.Object

Object itself.

Referent of type AdaCL.Pointer.Unique.Pointer

pointer to element

Reset (renaming) [source]

80 procedure Reset (This : in out Object; Referent : in Pointer := null) renames Delegate.Reset;

Replaces the managed object.

This of type AdaCL.Pointer.Unique.Object

Object itself.

Referent of type AdaCL.Pointer.Unique.Pointer

new pointer to manage

Swap (renaming) [source]

87 procedure Swap (This : in out Object; Other : in out Object) renames Delegate.Swap;

swaps the managed objects

This of type AdaCL.Pointer.Unique.Object

Object itself.

Other of type AdaCL.Pointer.Unique.Object

Object to swap Referents with

Delegate (generic instantiation) [source]

43package Delegate is new AdaCL.Pointer.Unique_With_Delete (Element_Type => Element_Type, Pointer => Pointer);

Instantiation of AdaCL.Pointer.Unique_With_Delete

Deleter (generic instantiation) [source]

41 procedure Deleter is new Ada.Unchecked_Deallocation (Object => Element_Type, Name => Pointer);