AdaCL.Pointer.Element

Ada Class Library Base Class for Reference Counted Instances.

More...

Entities

Access types

Object_Class

Interface types

Object_Interface

Tagged types

Object

Dispatching subprograms

Add_Reference
Add_Reference
Get_Name
Object_Image
Remove_Reference
Remove_Reference
Use_Count
Use_Count

Description

Element and Holder: A reference counted smart pointer for tagged types where the reference is kept inside the tagged type. This is slightly faster, uses less memory and is more reliable. However it can only be uses for limited tagged types and you need to implement the interface.

Object_Class [source]

84 type Object_Class is access Object'Class;

Object_Interface [source]

47 type Object_Interface is limited interface and AdaCL.Limited_Base.Object_Interface;

Interface Class for Reference Counted Instances Use the interface in when using the base class is not possible. Type for which we want to supply a reference counter. Since, in Ada one can not overload the ":=" operator the type need to be limited so the counter is not damaged by assignment. Mind you, in C++ I almost always make the operator = private in in Reference counted classes as well.

Inherits Object_Interface

Inherited by Element_Type

Object [source]

82 type Object is new AdaCL.Limited_Base.Object and Object_Interface with private;

Base Class for Reference Counted Instances.

Inherits Object, Object_Interface

Inherited by Object

Add_Reference [source]

53 procedure Add_Reference (This : in out Object_Interface) is abstract;

Add a reference

This of type AdaCL.Pointer.Element.Object_Interface

Object itself.

Add_Reference [source]

90 overriding procedure Add_Reference (This : in out Object) with
91 Inline;

Add a reference

This of type AdaCL.Pointer.Element.Object

Object itself.

Get_Name [source]

75 overriding function Get_Name (This : in Object_Interface) return String is abstract;

Get name of Class.

This of type AdaCL.Pointer.Element.Object_Interface

Object itself.

Return value

Object_Image [source]

119 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.Element.Object

Remove_Reference [source]

63 procedure Remove_Reference (This : in out Object_Interface) is abstract;

Remove a reference. However since an object and a pointer is passed the instance is not deleted. The caller is responsible to call Use_Count and check if delete is needed. Concurrency: Guarded

This of type AdaCL.Pointer.Element.Object_Interface

Object itself.

Remove_Reference [source]

99 overriding procedure Remove_Reference (This : in out Object);

Remove a reference. However since an object and a pointer is passed the instance is not deleted. The caller is responsible to call Use_Count and check if delete is needed.

This of type AdaCL.Pointer.Element.Object

Object itself.

Use_Count [source]

69 function Use_Count (This : in Object_Interface) return Natural is abstract;

Current reference counter.

This of type AdaCL.Pointer.Element.Object_Interface

Object itself.

Return value

Use_Count [source]

105 overriding function Use_Count (This : in Object) return Natural with
106 Inline;

Current reference counter.

This of type AdaCL.Pointer.Element.Object

Object itself.

Return value