* arm.c (FL_WBUF): Define.
[official-gcc.git] / gcc / ada / a-cihama.ads
blob7769cbb1a83c9009bd710c014184e01421c4c4fc
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT LIBRARY COMPONENTS --
4 -- --
5 -- ADA.CONTAINERS.INDEFINITE_HASHED_MAPS --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2004 Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 2, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
21 -- for more details. You should have received a copy of the GNU General --
22 -- Public License distributed with GNAT; see file COPYING. If not, write --
23 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
24 -- MA 02111-1307, USA. --
25 -- --
26 -- As a special exception, if other files instantiate generics from this --
27 -- unit, or you link this unit with other files to produce an executable, --
28 -- this unit does not by itself cause the resulting executable to be --
29 -- covered by the GNU General Public License. This exception does not --
30 -- however invalidate any other reasons why the executable file might be --
31 -- covered by the GNU Public License. --
32 -- --
33 -- This unit was originally developed by Matthew J Heaney. --
34 ------------------------------------------------------------------------------
36 with Ada.Containers.Hash_Tables;
37 with Ada.Streams;
39 generic
40 type Key_Type (<>) is private;
41 type Element_Type (<>) is private;
43 with function Hash (Key : Key_Type) return Hash_Type;
44 with function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
45 with function "=" (Left, Right : Element_Type) return Boolean is <>;
47 package Ada.Containers.Indefinite_Hashed_Maps is
48 pragma Preelaborate (Indefinite_Hashed_Maps);
50 type Map is tagged private;
51 type Cursor is private;
53 Empty_Map : constant Map;
54 No_Element : constant Cursor;
56 function "=" (Left, Right : Map) return Boolean;
58 function Length (Container : Map) return Count_Type;
60 function Is_Empty (Container : Map) return Boolean;
62 procedure Clear (Container : in out Map);
64 function Element (Position : Cursor) return Element_Type;
66 procedure Query_Element
67 (Position : Cursor;
68 Process : not null access procedure (Key : Key_Type;
69 Element : Element_Type));
71 procedure Update_Element
72 (Position : Cursor;
73 Process : not null access procedure (Key : Key_Type;
74 Element : in out Element_Type));
76 procedure Replace_Element
77 (Position : Cursor;
78 By : Element_Type);
80 procedure Move (Target : in out Map; Source : in out Map);
82 procedure Insert
83 (Container : in out Map;
84 Key : Key_Type;
85 New_Item : Element_Type;
86 Position : out Cursor;
87 Inserted : out Boolean);
89 procedure Insert
90 (Container : in out Map;
91 Key : Key_Type;
92 New_Item : Element_Type);
94 procedure Include
95 (Container : in out Map;
96 Key : Key_Type;
97 New_Item : Element_Type);
99 procedure Replace
100 (Container : in out Map;
101 Key : Key_Type;
102 New_Item : Element_Type);
104 procedure Delete
105 (Container : in out Map;
106 Key : Key_Type);
108 procedure Exclude
109 (Container : in out Map;
110 Key : Key_Type);
112 procedure Delete
113 (Container : in out Map;
114 Position : in out Cursor);
116 function Contains
117 (Container : Map;
118 Key : Key_Type) return Boolean;
120 function Find
121 (Container : Map;
122 Key : Key_Type) return Cursor;
124 function Element
125 (Container : Map;
126 Key : Key_Type) return Element_Type;
128 function Capacity (Container : Map) return Count_Type;
130 procedure Reserve_Capacity
131 (Container : in out Map;
132 Capacity : Count_Type);
134 function First (Container : Map) return Cursor;
136 function Next (Position : Cursor) return Cursor;
138 procedure Next (Position : in out Cursor);
140 function Has_Element (Position : Cursor) return Boolean;
142 function Key (Position : Cursor) return Key_Type;
144 function Equivalent_Keys (Left, Right : Cursor)
145 return Boolean;
147 function Equivalent_Keys
148 (Left : Cursor;
149 Right : Key_Type) return Boolean;
151 function Equivalent_Keys
152 (Left : Key_Type;
153 Right : Cursor) return Boolean;
155 procedure Iterate
156 (Container : Map;
157 Process : not null access procedure (Position : Cursor));
159 private
160 type Node_Type;
161 type Node_Access is access Node_Type;
163 package HT_Types is
164 new Hash_Tables.Generic_Hash_Table_Types (Node_Access);
166 use HT_Types;
168 type Map is new Hash_Table_Type with null record;
170 procedure Adjust (Container : in out Map);
172 procedure Finalize (Container : in out Map);
174 type Map_Access is access constant Map;
175 for Map_Access'Storage_Size use 0;
177 type Cursor is
178 record
179 Container : Map_Access;
180 Node : Node_Access;
181 end record;
183 No_Element : constant Cursor :=
184 (Container => null,
185 Node => null);
187 use Ada.Streams;
189 procedure Write
190 (Stream : access Root_Stream_Type'Class;
191 Container : Map);
193 for Map'Write use Write;
195 procedure Read
196 (Stream : access Root_Stream_Type'Class;
197 Container : out Map);
199 for Map'Read use Read;
201 Empty_Map : constant Map := (Hash_Table_Type with null record);
203 end Ada.Containers.Indefinite_Hashed_Maps;