PR c++/54038
[official-gcc.git] / gcc / ada / a-btgbso.ads
blob06b58297eb0d6951b20bbcfb93bded5727bde713
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT LIBRARY COMPONENTS --
4 -- --
5 -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_SET_OPERATIONS --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- This unit was originally developed by Matthew J Heaney. --
28 ------------------------------------------------------------------------------
30 -- Tree_Type is used to implement ordered containers. This package declares
31 -- set-based tree operations.
33 with Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations;
35 generic
36 with package Tree_Operations is new Generic_Bounded_Operations (<>);
38 type Set_Type is new Tree_Operations.Tree_Types.Tree_Type with private;
40 use Tree_Operations.Tree_Types;
42 with procedure Assign (Target : in out Set_Type; Source : Set_Type);
44 with procedure Insert_With_Hint
45 (Dst_Set : in out Set_Type;
46 Dst_Hint : Count_Type;
47 Src_Node : Node_Type;
48 Dst_Node : out Count_Type);
50 with function Is_Less (Left, Right : Node_Type) return Boolean;
52 package Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations is
53 pragma Pure;
55 procedure Set_Union (Target : in out Set_Type; Source : Set_Type);
56 -- Attempts to insert each element of Source in Target. If Target is
57 -- busy then Program_Error is raised. We say "attempts" here because
58 -- if these are unique-element sets, then the insertion should fail
59 -- (not insert a new item) when the insertion item from Source is
60 -- equivalent to an item already in Target. If these are multisets
61 -- then of course the attempt should always succeed.
63 function Set_Union (Left, Right : Set_Type) return Set_Type;
64 -- Makes a copy of Left, and attempts to insert each element of
65 -- Right into the copy, then returns the copy.
67 procedure Set_Intersection (Target : in out Set_Type; Source : Set_Type);
68 -- Removes elements from Target that are not equivalent to items in
69 -- Source. If Target is busy then Program_Error is raised.
71 function Set_Intersection (Left, Right : Set_Type) return Set_Type;
72 -- Returns a set comprising all the items in Left equivalent to items in
73 -- Right.
75 procedure Set_Difference (Target : in out Set_Type; Source : Set_Type);
76 -- Removes elements from Target that are equivalent to items in Source. If
77 -- Target is busy then Program_Error is raised.
79 function Set_Difference (Left, Right : Set_Type) return Set_Type;
80 -- Returns a set comprising all the items in Left not equivalent to items
81 -- in Right.
83 procedure Set_Symmetric_Difference
84 (Target : in out Set_Type;
85 Source : Set_Type);
86 -- Removes from Target elements that are equivalent to items in Source,
87 -- and inserts into Target items from Source not equivalent elements in
88 -- Target. If Target is busy then Program_Error is raised.
90 function Set_Symmetric_Difference (Left, Right : Set_Type) return Set_Type;
91 -- Returns a set comprising the union of the elements in Left not
92 -- equivalent to items in Right, and the elements in Right not equivalent
93 -- to items in Left.
95 function Set_Subset (Subset : Set_Type; Of_Set : Set_Type) return Boolean;
96 -- Returns False if Subset contains at least one element not equivalent to
97 -- any item in Of_Set; returns True otherwise.
99 function Set_Overlap (Left, Right : Set_Type) return Boolean;
100 -- Returns True if at least one element of Left is equivalent to an item in
101 -- Right; returns False otherwise.
103 end Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations;