OSDN Git Service

2006-10-31 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-cihama.ads
index 8156dbd..b1b4630 100644 (file)
@@ -7,7 +7,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 --
@@ -47,16 +47,25 @@ generic
    with function "=" (Left, Right : Element_Type) return Boolean is <>;
 
 package Ada.Containers.Indefinite_Hashed_Maps is
-   pragma Preelaborate (Indefinite_Hashed_Maps);
+   pragma Preelaborate;
 
    type Map is tagged private;
+   pragma Preelaborable_Initialization (Map);
+
    type Cursor is private;
+   pragma Preelaborable_Initialization (Cursor);
 
    Empty_Map  : constant Map;
    No_Element : constant Cursor;
 
    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;
@@ -67,20 +76,22 @@ package Ada.Containers.Indefinite_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 procedure (Key     : Key_Type;
+     (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
@@ -105,29 +116,11 @@ package Ada.Containers.Indefinite_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;
+   procedure Exclude (Container : in out Map; Key : Key_Type);
 
-   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;
 
@@ -135,29 +128,24 @@ package Ada.Containers.Indefinite_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;
+   function Equivalent_Keys (Left, Right : Cursor) return Boolean;
 
-   function Equivalent_Keys
-     (Left  : Cursor;
-      Right : Key_Type) return Boolean;
+   function Equivalent_Keys (Left : Cursor; Right : Key_Type) return Boolean;
 
-   function Equivalent_Keys
-     (Left  : Key_Type;
-      Right : Cursor) return Boolean;
+   function Equivalent_Keys (Left : Key_Type; Right : Cursor) return Boolean;
 
    procedure Iterate
      (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);
@@ -194,6 +182,7 @@ private
 
    use HT_Types;
    use Ada.Finalization;
+   use Ada.Streams;
 
    procedure Adjust (Container : in out Map);
 
@@ -208,12 +197,22 @@ private
          Node      : Node_Access;
       end record;
 
+   procedure Write
+     (Stream : access Root_Stream_Type'Class;
+      Item   : Cursor);
+
+   for Cursor'Write use Write;
+
+   procedure Read
+     (Stream : access Root_Stream_Type'Class;
+      Item   : out Cursor);
+
+   for Cursor'Read use Read;
+
    No_Element : constant Cursor :=
      (Container => null,
       Node      => null);
 
-   use Ada.Streams;
-
    procedure Write
      (Stream    : access Root_Stream_Type'Class;
       Container : Map);