-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2006, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
generic
type Key_Type is private;
-
type Element_Type is private;
with function Hash (Key : Key_Type) return Hash_Type;
-
with function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
-
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Hashed_Maps is
pragma Preelaborate;
type Map is tagged private;
+ pragma Preelaborable_Initialization (Map);
type Cursor is private;
+ pragma Preelaborable_Initialization (Cursor);
Empty_Map : constant Map;
function "=" (Left, Right : Map) return Boolean;
+ function Capacity (Container : Map) return Count_Type;
+
+ procedure Reserve_Capacity (Container : in out Map;
+ Capacity : Count_Type);
+
function Length (Container : Map) return Count_Type;
function Is_Empty (Container : Map) return Boolean;
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out Map;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : Element_Type));
procedure Update_Element
- (Position : Cursor;
- Process : not null access
+ (Container : in out Map;
+ Position : Cursor;
+ Process : not null access
procedure (Key : Key_Type; Element : in out Element_Type));
- procedure Replace_Element (Position : Cursor; By : Element_Type);
-
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
Key : Key_Type;
New_Item : Element_Type);
- procedure Delete (Container : in out Map; Key : Key_Type);
-
- procedure Delete (Container : in out Map; Position : in out Cursor);
-
procedure Exclude (Container : in out Map; Key : Key_Type);
- function Contains (Container : Map; Key : Key_Type) return Boolean;
-
- function Find (Container : Map; Key : Key_Type) return Cursor;
+ procedure Delete (Container : in out Map; Key : Key_Type);
- function Element (Container : Map; Key : Key_Type) return Element_Type;
+ procedure Delete (Container : in out Map; Position : in out Cursor);
function First (Container : Map) return Cursor;
procedure Next (Position : in out Cursor);
+ function Find (Container : Map; Key : Key_Type) return Cursor;
+
+ function Contains (Container : Map; Key : Key_Type) return Boolean;
+
+ function Element (Container : Map; Key : Key_Type) return Element_Type;
+
function Has_Element (Position : Cursor) return Boolean;
function Equivalent_Keys (Left, Right : Cursor) return Boolean;
(Container : Map;
Process : not null access procedure (Position : Cursor));
- function Capacity (Container : Map) return Count_Type;
-
- procedure Reserve_Capacity (Container : in out Map;
- Capacity : Count_Type);
-
private
pragma Inline ("=");
pragma Inline (Length);
use Ada.Streams;
procedure Write
- (Stream : access Root_Stream_Type'Class;
+ (Stream : not null access Root_Stream_Type'Class;
Container : Map);
for Map'Write use Write;
procedure Read
- (Stream : access Root_Stream_Type'Class;
+ (Stream : not null access Root_Stream_Type'Class;
Container : out Map);
for Map'Read use Read;
Node : Node_Access;
end record;
+ procedure Read
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ procedure Write
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : Cursor);
+
+ for Cursor'Write use Write;
+
No_Element : constant Cursor := (Container => null, Node => null);
end Ada.Containers.Hashed_Maps;