-
Notifications
You must be signed in to change notification settings - Fork 0
/
src-unbounded_ordered_maps.adb
56 lines (49 loc) · 1.79 KB
/
src-unbounded_ordered_maps.adb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
-- SPARK Reusable Components (SRC)
-- Copyright (C) by PragmAda Software Engineering. All rights reserved.
-- Released under the terms of the BSD 3-Clause license; see https://opensource.org/licenses
-- **************************************************************************
--
-- Unbounded, ordered maps
--
-- History:
-- 2023 Aug 15 J. Carter V1.0--Initial version
--
package body SRC.Unbounded_Ordered_Maps is
procedure Assign (To : in out Handle; From : in Handle) is
-- Empty
begin -- Assign
Lists.Assign (To => To.List, From => From.List);
end Assign;
procedure Clear (Map : in out Handle) is
-- Empty
begin -- Clear
Lists.Clear (Set => Map.List);
end Clear;
procedure Insert (Into : in out Handle; Key : in Key_Info; Value : in Value_Info) is
-- Empty
begin -- Insert
Lists.Insert (Into => Into.List, Item => (Key => Key, Value => Value) );
end Insert;
procedure Update (Into : in out Handle; Key : in Key_Info; Value : in Value_Info) is
-- Empty
begin -- Update
Lists.Update (Into => Into.List, Item => (Key => Key, Value => Value) );
end Update;
procedure Delete (From : in out Handle; Key : in Key_Info) is
-- Empty
begin -- Delete
Lists.Delete (From => From.List, Item => (Key => Key, Value => Dummy_Value) );
end Delete;
procedure Iterate (Over : in out Handle) is
procedure Action (Item : in Pair);
-- Calls the supplied Action with the components of Item
procedure Local is new Lists.Iterate (Action => Action);
procedure Action (Item : in Pair) is
-- Empty
begin -- Action
Action (Key => Item.Key, Value => Item.Value);
end Action;
begin -- Iterate
Local (Over => Over.List);
end Iterate;
end SRC.Unbounded_Ordered_Maps;