1 ------------------------------------------------------------------------------
3 -- GNAT LIBRARY COMPONENTS --
5 -- A D A . C O N T A I N E R S . R E D _ B L A C K _ T R E E S . --
6 -- G E N E R I C _ O P E R A T I O N S --
10 -- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
12 -- This specification is derived from the Ada Reference Manual for use with --
13 -- GNAT. The copyright notice above, and the license provisions that follow --
14 -- apply solely to the contents of the part following the private keyword. --
16 -- GNAT is free software; you can redistribute it and/or modify it under --
17 -- terms of the GNU General Public License as published by the Free Soft- --
18 -- ware Foundation; either version 2, or (at your option) any later ver- --
19 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
20 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
21 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
22 -- for more details. You should have received a copy of the GNU General --
23 -- Public License distributed with GNAT; see file COPYING. If not, write --
24 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
25 -- Boston, MA 02110-1301, USA. --
27 -- As a special exception, if other files instantiate generics from this --
28 -- unit, or you link this unit with other files to produce an executable, --
29 -- this unit does not by itself cause the resulting executable to be --
30 -- covered by the GNU General Public License. This exception does not --
31 -- however invalidate any other reasons why the executable file might be --
32 -- covered by the GNU Public License. --
34 -- This unit was originally developed by Matthew J Heaney. --
35 ------------------------------------------------------------------------------
37 with Ada
.Streams
; use Ada
.Streams
;
40 with package Tree_Types
is new Generic_Tree_Types
(<>);
43 with function Parent
(Node
: Node_Access
) return Node_Access
is <>;
44 with procedure Set_Parent
(Node
: Node_Access
; Parent
: Node_Access
) is <>;
45 with function Left
(Node
: Node_Access
) return Node_Access
is <>;
46 with procedure Set_Left
(Node
: Node_Access
; Left
: Node_Access
) is <>;
47 with function Right
(Node
: Node_Access
) return Node_Access
is <>;
48 with procedure Set_Right
(Node
: Node_Access
; Right
: Node_Access
) is <>;
49 with function Color
(Node
: Node_Access
) return Color_Type
is <>;
50 with procedure Set_Color
(Node
: Node_Access
; Color
: Color_Type
) is <>;
52 package Ada
.Containers
.Red_Black_Trees
.Generic_Operations
is
55 function Min
(Node
: Node_Access
) return Node_Access
;
57 function Max
(Node
: Node_Access
) return Node_Access
;
59 procedure Check_Invariant
(Tree
: Tree_Type
);
61 function Next
(Node
: Node_Access
) return Node_Access
;
63 function Previous
(Node
: Node_Access
) return Node_Access
;
66 with function Is_Equal
(L
, R
: Node_Access
) return Boolean;
67 function Generic_Equal
(Left
, Right
: Tree_Type
) return Boolean;
69 procedure Delete_Node_Sans_Free
70 (Tree
: in out Tree_Type
;
74 with procedure Free
(X
: in out Node_Access
);
75 procedure Generic_Delete_Tree
(X
: in out Node_Access
);
78 with function Copy_Node
(Source
: Node_Access
) return Node_Access
;
79 with procedure Delete_Tree
(X
: in out Node_Access
);
80 function Generic_Copy_Tree
(Source_Root
: Node_Access
) return Node_Access
;
83 with function Copy_Tree
(Root
: Node_Access
) return Node_Access
;
84 procedure Generic_Adjust
(Tree
: in out Tree_Type
);
87 with procedure Delete_Tree
(X
: in out Node_Access
);
88 procedure Generic_Clear
(Tree
: in out Tree_Type
);
91 with procedure Clear
(Tree
: in out Tree_Type
);
92 procedure Generic_Move
(Target
, Source
: in out Tree_Type
);
95 with procedure Process
(Node
: Node_Access
) is <>;
96 procedure Generic_Iteration
(Tree
: Tree_Type
);
99 with procedure Process
(Node
: Node_Access
) is <>;
100 procedure Generic_Reverse_Iteration
(Tree
: Tree_Type
);
103 with procedure Write_Node
104 (Stream
: access Root_Stream_Type
'Class;
106 procedure Generic_Write
107 (Stream
: access Root_Stream_Type
'Class;
111 with procedure Clear
(Tree
: in out Tree_Type
);
112 with function Read_Node
113 (Stream
: access Root_Stream_Type
'Class) return Node_Access
;
114 procedure Generic_Read
115 (Stream
: access Root_Stream_Type
'Class;
116 Tree
: in out Tree_Type
);
118 procedure Rebalance_For_Insert
119 (Tree
: in out Tree_Type
;
122 end Ada
.Containers
.Red_Black_Trees
.Generic_Operations
;