70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
Constructor : not null access function return Held_Data) is
begin
Finalize (Ref);
Ref.Data := new Held_Data'(Constructor.all);
Ref.Count := new Counter'(1);
end Replace;
procedure Reset (Ref : in out Immutable_Reference) is
begin
Finalize (Ref);
end Reset;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
Constructor : not null access function return Held_Data) is
begin
Finalize (Ref);
Ref.Data := new Held_Data'(Constructor.all);
Ref.Count := new Counter'(1);
end Replace;
function Create
(Constructor : not null access function return Data_Access)
return Immutable_Reference is
begin
return (Ada.Finalization.Controlled with
Data => Constructor.all,
Count => new Counter'(1));
end Create;
procedure Replace
(Ref : in out Immutable_Reference;
Constructor : not null access function return Data_Access) is
begin
Finalize (Ref);
Ref.Data := Constructor.all;
Ref.Count := new Counter'(1);
end Replace;
procedure Reset (Ref : in out Immutable_Reference) is
begin
Finalize (Ref);
end Reset;
|