19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
-- type of objects. --
-- This is a basic implementation that does not support weak references or --
-- concurrency. However since there is no internal state, operations on --
-- non-overlapping objects should be thread-safe. --
------------------------------------------------------------------------------
with Ada.Finalization;
generic
type Held_Data (<>) is limited private;
package Natools.References is
pragma Preelaborate (References);
type Reference is new Ada.Finalization.Controlled with private;
type Accessor (Data : not null access constant Held_Data) is
|
>
>
>
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
-- type of objects. --
-- This is a basic implementation that does not support weak references or --
-- concurrency. However since there is no internal state, operations on --
-- non-overlapping objects should be thread-safe. --
------------------------------------------------------------------------------
with Ada.Finalization;
with System.Storage_Pools;
generic
type Held_Data (<>) is limited private;
Counter_Pool : in out System.Storage_Pools.Root_Storage_Pool'Class;
Data_Pool : in out System.Storage_Pools.Root_Storage_Pool'Class;
package Natools.References is
pragma Preelaborate (References);
type Reference is new Ada.Finalization.Controlled with private;
type Accessor (Data : not null access constant Held_Data) is
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
Null_Reference : constant Reference;
private
type Counter is new Natural;
type Counter_Access is access Counter;
type Data_Access is access Held_Data;
type Reference is new Ada.Finalization.Controlled with record
Count : Counter_Access := null;
Data : Data_Access := null;
end record;
overriding procedure Adjust (Object : in out Reference);
|
>
>
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
Null_Reference : constant Reference;
private
type Counter is new Natural;
type Counter_Access is access Counter;
for Counter_Access'Storage_Pool use Counter_Pool;
type Data_Access is access Held_Data;
for Data_Access'Storage_Pool use Data_Pool;
type Reference is new Ada.Finalization.Controlled with record
Count : Counter_Access := null;
Data : Data_Access := null;
end record;
overriding procedure Adjust (Object : in out Reference);
|