diff options
author | Matthew Heaney <heaney@adacore.com> | 2005-11-15 14:54:02 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2005-11-15 14:54:02 +0100 |
commit | 2368f04ec19f5d2aa5439e2454217d3135603dd0 (patch) | |
tree | 129bc8844811a17598b415668a54b3f7b4c278d7 /gcc/ada/a-coormu.ads | |
parent | 5e61ef090a8910843dd421fad19eae41c4fca816 (diff) | |
download | gcc-2368f04ec19f5d2aa5439e2454217d3135603dd0.zip gcc-2368f04ec19f5d2aa5439e2454217d3135603dd0.tar.gz gcc-2368f04ec19f5d2aa5439e2454217d3135603dd0.tar.bz2 |
a-crbtgo.ads, [...]: Compiles against the spec for ordered maps described in sections A.18.6 of the...
2005-11-14 Matthew Heaney <heaney@adacore.com>
* a-crbtgo.ads, a-crbtgo.adb, a-coorse.ads, a-coorse.adb, a-convec.ads,
a-convec.adb, a-coinve.ads, a-coinve.adb, a-cohama.ads, a-cohama.adb,
a-ciorse.ads, a-ciorse.adb, a-cihama.ads, a-cihama.adb, a-cidlli.ads,
a-cidlli.adb, a-cdlili.ads, a-cdlili.adb, a-coormu.adb, a-ciormu.adb,
a-cihase.adb, a-cihase.ads, a-cohase.adb, a-cohase.ads, a-ciorma.ads,
a-coorma.ads, a-ciormu.ads, a-coormu.ads, a-ciorma.adb, a-coorma.adb:
Compiles against the spec for ordered maps described in sections
A.18.6 of the most recent (August 2005) AI-302 draft.
From-SVN: r106962
Diffstat (limited to 'gcc/ada/a-coormu.ads')
-rw-r--r-- | gcc/ada/a-coormu.ads | 95 |
1 files changed, 52 insertions, 43 deletions
diff --git a/gcc/ada/a-coormu.ads b/gcc/ada/a-coormu.ads index cb42f07..ab3d4d4 100644 --- a/gcc/ada/a-coormu.ads +++ b/gcc/ada/a-coormu.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2005 Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2005, 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 -- @@ -46,6 +46,8 @@ generic package Ada.Containers.Ordered_Multisets is pragma Preelaborate; + function Equivalent_Elements (Left, Right : Element_Type) return Boolean; + type Set is tagged private; type Cursor is private; @@ -58,6 +60,8 @@ package Ada.Containers.Ordered_Multisets is function Equivalent_Sets (Left, Right : Set) return Boolean; + function To_Set (New_Item : Element_Type) return Set; + function Length (Container : Set) return Count_Type; function Is_Empty (Container : Set) return Boolean; @@ -66,18 +70,16 @@ package Ada.Containers.Ordered_Multisets is function Element (Position : Cursor) return Element_Type; + procedure Replace_Element + (Container : in out Set; + Position : Cursor; + New_Item : Element_Type); + procedure Query_Element (Position : Cursor; Process : not null access procedure (Element : Element_Type)); - procedure Replace_Element - (Container : Set; - Position : Cursor; - By : Element_Type); - - procedure Move - (Target : in out Set; - Source : in out Set); + procedure Move (Target : in out Set; Source : in out Set); procedure Insert (Container : in out Set; @@ -88,6 +90,16 @@ package Ada.Containers.Ordered_Multisets is (Container : in out Set; New_Item : Element_Type); +-- TODO: include Replace too??? +-- +-- procedure Replace +-- (Container : in out Set; +-- New_Item : Element_Type); + + procedure Exclude + (Container : in out Set; + Item : Element_Type); + procedure Delete (Container : in out Set; Item : Element_Type); @@ -100,10 +112,6 @@ package Ada.Containers.Ordered_Multisets is procedure Delete_Last (Container : in out Set); - procedure Exclude - (Container : in out Set; - Item : Element_Type); - procedure Union (Target : in out Set; Source : Set); function Union (Left, Right : Set) return Set; @@ -132,14 +140,6 @@ package Ada.Containers.Ordered_Multisets is function Is_Subset (Subset : Set; Of_Set : Set) return Boolean; - function Contains (Container : Set; Item : Element_Type) return Boolean; - - function Find (Container : Set; Item : Element_Type) return Cursor; - - function Floor (Container : Set; Item : Element_Type) return Cursor; - - function Ceiling (Container : Set; Item : Element_Type) return Cursor; - function First (Container : Set) return Cursor; function First_Element (Container : Set) return Element_Type; @@ -156,6 +156,14 @@ package Ada.Containers.Ordered_Multisets is procedure Previous (Position : in out Cursor); + function Find (Container : Set; Item : Element_Type) return Cursor; + + function Floor (Container : Set; Item : Element_Type) return Cursor; + + function Ceiling (Container : Set; Item : Element_Type) return Cursor; + + function Contains (Container : Set; Item : Element_Type) return Boolean; + function Has_Element (Position : Cursor) return Boolean; function "<" (Left, Right : Cursor) return Boolean; @@ -189,47 +197,37 @@ package Ada.Containers.Ordered_Multisets is Process : not null access procedure (Position : Cursor)); generic - type Key_Type (<>) is limited private; + type Key_Type (<>) is private; with function Key (Element : Element_Type) return Key_Type; - with function "<" (Left : Key_Type; Right : Element_Type) - return Boolean is <>; - - with function ">" (Left : Key_Type; Right : Element_Type) - return Boolean is <>; + with function "<" (Left, Right : Key_Type) return Boolean is <>; package Generic_Keys is - function Contains (Container : Set; Key : Key_Type) return Boolean; - - function Find (Container : Set; Key : Key_Type) return Cursor; - - function Floor (Container : Set; Key : Key_Type) return Cursor; - - function Ceiling (Container : Set; Key : Key_Type) return Cursor; + function Equivalent_Keys (Left, Right : Key_Type) return Boolean; function Key (Position : Cursor) return Key_Type; function Element (Container : Set; Key : Key_Type) return Element_Type; - procedure Delete (Container : in out Set; Key : Key_Type); - procedure Exclude (Container : in out Set; Key : Key_Type); - function "<" (Left : Cursor; Right : Key_Type) return Boolean; + procedure Delete (Container : in out Set; Key : Key_Type); + + function Find (Container : Set; Key : Key_Type) return Cursor; - function ">" (Left : Cursor; Right : Key_Type) return Boolean; + function Floor (Container : Set; Key : Key_Type) return Cursor; - function "<" (Left : Key_Type; Right : Cursor) return Boolean; + function Ceiling (Container : Set; Key : Key_Type) return Cursor; - function ">" (Left : Key_Type; Right : Cursor) return Boolean; + function Contains (Container : Set; Key : Key_Type) return Boolean; procedure Update_Element_Preserving_Key (Container : in out Set; Position : Cursor; Process : not null access - procedure (Element : in out Element_Type)); + procedure (Element : in out Element_Type)); procedure Iterate (Container : Set; @@ -271,6 +269,7 @@ private use Red_Black_Trees; use Tree_Types; use Ada.Finalization; + use Ada.Streams; type Set_Access is access all Set; for Set_Access'Storage_Size use 0; @@ -280,9 +279,19 @@ private Node : Node_Access; end record; - No_Element : constant Cursor := Cursor'(null, null); + procedure Write + (Stream : access Root_Stream_Type'Class; + Item : Cursor); - use Ada.Streams; + 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 := Cursor'(null, null); procedure Write (Stream : access Root_Stream_Type'Class; |