Natools

Check-in [779fe5056a]
Login
Overview
Comment:references: add storage pool formal parameters
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 779fe5056a364d4e1b0b6f95f72d467b5d2409e6
User & Date: nat on 2013-09-24 18:28:15
Other Links: manifest | tags
Context
2013-09-25
20:07
coverage.sh: clear counters before each run check-in: 884da542c5 user: nat tags: trunk
2013-09-24
18:28
references: add storage pool formal parameters check-in: 779fe5056a user: nat tags: trunk
2013-09-23
18:26
reference_tests: full-coverage test suite for reference counter check-in: 681c468a7d user: nat tags: trunk
Changes

Modified src/natools-references.ads from [0fba189b0d] to [8596f1f0ff].

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);

Modified tests/natools-reference_tests.ads from [83c515b4b0] to [eb6f847a7f].

18
19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
-- Natools.Reference_Tests is a test suite for Natools.References           --
-- reference-counted object holder.                                         --
------------------------------------------------------------------------------

with Natools.Tests;

private with Ada.Finalization;
--  private with GNAT.Debug_Pools;
private with Natools.References;


package Natools.Reference_Tests is

   package NT renames Natools.Tests;

   procedure All_Tests (Report : in out NT.Reporter'Class);








|

>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- Natools.Reference_Tests is a test suite for Natools.References           --
-- reference-counted object holder.                                         --
------------------------------------------------------------------------------

with Natools.Tests;

private with Ada.Finalization;
private with GNAT.Debug_Pools;
private with Natools.References;
private with System.Storage_Pools;

package Natools.Reference_Tests is

   package NT renames Natools.Tests;

   procedure All_Tests (Report : in out NT.Reporter'Class);

44
45
46
47
48
49
50
51
52
53
54


55
56
   type Counter is new Ada.Finalization.Limited_Controlled with record
      Instance_Number : Natural := 0;
   end record;

   function Factory return Counter;
   overriding procedure Finalize (Object : in out Counter);

--   Pool : GNAT.Debug_Pools.Debug_Pool;

   package Refs is new Natools.References (Counter);
--     (Counter, System.Pool_Global.Global_Pool_Object, Pool);



end Natools.Reference_Tests;







|

|
|
>
>


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
   type Counter is new Ada.Finalization.Limited_Controlled with record
      Instance_Number : Natural := 0;
   end record;

   function Factory return Counter;
   overriding procedure Finalize (Object : in out Counter);

   Pool : GNAT.Debug_Pools.Debug_Pool;

   package Refs is new Natools.References
     (Counter,
      System.Storage_Pools.Root_Storage_Pool'Class (Pool),
      System.Storage_Pools.Root_Storage_Pool'Class (Pool));

end Natools.Reference_Tests;