OSDN Git Service

2007-04-20 Eric Botcazou <ebotcazou@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-cohama.ads
index 0c74943..a0bbad4 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 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 --
@@ -39,21 +39,20 @@ with Ada.Finalization;
 
 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;
 
@@ -61,6 +60,11 @@ package Ada.Containers.Hashed_Maps is
 
    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;
@@ -71,18 +75,22 @@ package Ada.Containers.Hashed_Maps is
 
    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
@@ -113,17 +121,11 @@ package Ada.Containers.Hashed_Maps is
       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;
 
@@ -131,6 +133,12 @@ package Ada.Containers.Hashed_Maps is
 
    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;
@@ -143,11 +151,6 @@ package Ada.Containers.Hashed_Maps is
      (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);
@@ -189,13 +192,13 @@ private
    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;
@@ -211,6 +214,18 @@ private
          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;