AdaCL.Pointer.Unique_With_Delete

AdaCL: Unique smart pointer.

More...

Entities

Access types

Instance_Access

Record types

Instance_Type

Tagged types

Object

Dispatching subprograms

Adjust
Create
Exist
Finalize
Get
Initialize
Object_Image
Release
Reset
Swap

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. Element_Type the element which are handled by the pointer Pointer Access to the element type Deleter function to delete an element instance

Instance_Access [source]

102 type Instance_Access is access Instance_Type;

Self referencing type consisting of three components: type of the self reference

Instance_Type [source]

97 type Instance_Type;

Self referencing type consisting of three components: This component holds the actual data. Details in the body.

Object [source]

45 type Object is new AdaCL.Base.Object with private;

A Pointer to an unique element.

Inherits Object

Inherited by Object

Adjust [source]

125 overriding procedure Adjust (This : in out Object);

When adjusting we need hand over the pointer

This of type AdaCL.Pointer.Unique_With_Delete.Object

Object itself.

Create [source]

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

Creates a new unique smart pointer from normal pointer.

Referent of type AdaCL.Pointer.Unique_With_Delete.Pointer

Pointer to reference counted object

Return value

New smart pointer

Exist [source]

59 function Exist (This : in Object) return Boolean with
60 Pure_Function, Inline;

Checks if a pointers is set

This of type AdaCL.Pointer.Unique_With_Delete.Object

Object itself.

Return value

true when pointer is not null

Finalize [source]

131 overriding procedure Finalize (This : in out Object);

When finalizing we need delete the pointer

This of type AdaCL.Pointer.Unique_With_Delete.Object

Object itself.

Get [source]

67 function Get (This : in Object) return not null Pointer with
68 Inline, Pre => (This.Exist), Post => (Get'Result /= null);

gets pointer to element to perform operations on. Do not save the pointer.

This of type AdaCL.Pointer.Unique_With_Delete.Object

Object itself.

Return value

pointer to element

Initialize [source]

119 overriding procedure Initialize (This : in out Object);

Called when creating an object

This of type AdaCL.Pointer.Unique_With_Delete.Object

Object itself.

Object_Image [source]

113 procedure Object_Image (Output : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class; This : Object);
Output of type Root_Buffer_Type
This of type AdaCL.Pointer.Unique_With_Delete.Object

Release [source]

75 procedure Release (This : in out Object; Referent : out not null Pointer) with
76 Pre => (This.Exist), Post => (Referent /= null);

gets pointer to element and releases ownership. You cans save this pointer.

This of type AdaCL.Pointer.Unique_With_Delete.Object

Object itself.

Referent of type AdaCL.Pointer.Unique_With_Delete.Pointer

pointer to element

Reset [source]

83 procedure Reset (This : in out Object; Referent : in Pointer := null);

Replaces the managed object.

This of type AdaCL.Pointer.Unique_With_Delete.Object

Object itself.

Referent of type AdaCL.Pointer.Unique_With_Delete.Pointer

new pointer to manage

Swap [source]

90 procedure Swap (This : in out Object; Other : in out Object);

swaps the managed objects

This of type AdaCL.Pointer.Unique_With_Delete.Object

Object itself.

Other of type AdaCL.Pointer.Unique_With_Delete.Object

Object to swap Referents with