summaryrefslogtreecommitdiffstats
path: root/gcc/ada/a-coinve.ads
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-coinve.ads')
-rw-r--r--gcc/ada/a-coinve.ads104
1 files changed, 85 insertions, 19 deletions
diff --git a/gcc/ada/a-coinve.ads b/gcc/ada/a-coinve.ads
index a8e8af21bd0..866beb9c55f 100644
--- a/gcc/ada/a-coinve.ads
+++ b/gcc/ada/a-coinve.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, 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 --
@@ -32,7 +32,8 @@
------------------------------------------------------------------------------
private with Ada.Finalization;
-private with Ada.Streams;
+with Ada.Streams; use Ada.Streams;
+with Ada.Iterator_Interfaces;
generic
type Index_Type is range <>;
@@ -50,7 +51,13 @@ package Ada.Containers.Indefinite_Vectors is
No_Index : constant Extended_Index := Extended_Index'First;
- type Vector is tagged private;
+ type Vector is tagged private
+ with
+ Constant_Indexing => Constant_Reference,
+ Variable_Indexing => Reference,
+ Default_Iterator => Iterate,
+ Iterator_Element => Element_Type;
+
pragma Preelaborable_Initialization (Vector);
type Cursor is private;
@@ -59,6 +66,22 @@ package Ada.Containers.Indefinite_Vectors is
Empty_Vector : constant Vector;
No_Element : constant Cursor;
+ function Has_Element (Position : Cursor) return Boolean;
+
+ procedure Read
+ (Stream : not null access Root_Stream_Type'Class;
+ Position : out Cursor);
+
+ for Cursor'Read use Read;
+
+ procedure Write
+ (Stream : not null access Root_Stream_Type'Class;
+ Position : Cursor);
+
+ for Cursor'Write use Write;
+
+ package Vector_Iterator_Interfaces is new
+ Ada.Iterator_Interfaces (Cursor, Has_Element);
overriding function "=" (Left, Right : Vector) return Boolean;
@@ -92,6 +115,53 @@ package Ada.Containers.Indefinite_Vectors is
procedure Clear (Container : in out Vector);
+ type Constant_Reference_Type
+ (Element : not null access constant Element_Type) is private
+ with
+ Implicit_Dereference => Element;
+
+ procedure Write
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : Constant_Reference_Type);
+
+ for Constant_Reference_Type'Write use Write;
+
+ procedure Read
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : out Constant_Reference_Type);
+
+ for Constant_Reference_Type'Read use Read;
+
+ type Reference_Type (Element : not null access Element_Type) is private
+ with
+ Implicit_Dereference => Element;
+
+ procedure Write
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : Reference_Type);
+
+ for Reference_Type'Write use Write;
+
+ procedure Read
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : out Reference_Type);
+
+ for Reference_Type'Read use Read;
+
+ function Constant_Reference
+ (Container : Vector; Position : Cursor) -- SHOULD BE ALIASED
+ return Constant_Reference_Type;
+
+ function Constant_Reference
+ (Container : Vector; Position : Index_Type)
+ return Constant_Reference_Type;
+
+ function Reference (Container : Vector; Position : Cursor)
+ return Reference_Type;
+
+ function Reference (Container : Vector; Position : Index_Type)
+ return Reference_Type;
+
function To_Cursor
(Container : Vector;
Index : Extended_Index) return Cursor;
@@ -267,12 +337,16 @@ package Ada.Containers.Indefinite_Vectors is
(Container : Vector;
Item : Element_Type) return Boolean;
- function Has_Element (Position : Cursor) return Boolean;
-
procedure Iterate
(Container : Vector;
Process : not null access procedure (Position : Cursor));
+ function Iterate (Container : Vector)
+ return Vector_Iterator_Interfaces.Reversible_Iterator'class;
+
+ function Iterate (Container : Vector; Start : Cursor)
+ return Vector_Iterator_Interfaces.Reversible_Iterator'class;
+
procedure Reverse_Iterate
(Container : Vector;
Process : not null access procedure (Position : Cursor));
@@ -323,12 +397,16 @@ private
Lock : Natural := 0;
end record;
+ type Constant_Reference_Type
+ (Element : not null access constant Element_Type) is null record;
+
+ type Reference_Type
+ (Element : not null access Element_Type) is null record;
+
overriding procedure Adjust (Container : in out Vector);
overriding procedure Finalize (Container : in out Vector);
- use Ada.Streams;
-
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Vector);
@@ -349,18 +427,6 @@ private
Index : Index_Type := Index_Type'First;
end record;
- procedure Write
- (Stream : not null access Root_Stream_Type'Class;
- Position : Cursor);
-
- for Cursor'Write use Write;
-
- procedure Read
- (Stream : not null access Root_Stream_Type'Class;
- Position : out Cursor);
-
- for Cursor'Read use Read;
-
Empty_Vector : constant Vector := (Controlled with null, No_Index, 0, 0);
No_Element : constant Cursor := Cursor'(null, Index_Type'First);
OpenPOWER on IntegriCloud