--::::::::::
--prqucncn.ads -- priority_queue_cntl_cntl
--::::::::::
--| Object_Type must be CONTROLLED
--| The priority queue is CONTROLLED
with priority_queue_lpbase, Ada.Finalization; --, Pt_To_Lpt;
use Ada.FInalization;
generic
type Object_Type is private ;
with procedure Swap (Source: in out Object_Type ;
Target: in out Object_Type ) ;
type Priority_Type is (<>) ;
with function "<" (Left, Right : Priority_Type) return boolean ;
package Priority_Queue_Cntl_Cntl is
---------------------------------------------------
-- DO NOT USE prq & ptl
-- package ptl is new Pt_To_Lpt (Object_Type);
procedure Null_Proc (Object : in out Object_Type);
package prq is new priority_queue_lpbase
(Object_Type, Null_Proc, Null_Proc, Swap, Priority_Type, "<");
---------------------------------------------------
type PQ_Type (Max_Size : positive) is new controlled with private ;
PQ_Underflow: exception renames prq.PQ_Underflow;
PQ_Overflow : exception renames prq.PQ_Overflow;
procedure Enq (Object : in out Object_Type ;
Priority: in Priority_Type ;
Queue : in out PQ_Type ) ;
-- NOTE: Swap used to exchange value of Object_Type
procedure Deq (Queue : in out PQ_Type ;
Object: in out Object_Type ) ;
-- NOTE: Swap used to exchange value of Object_Type
function Empty (Queue: PQ_Type) return boolean ;
function Size (Queue: PQ_Type) return positive ;
private
procedure Initialize (Queue: in out PQ_Type);
procedure Finalize (Queue: in out PQ_Type);
type PQ_Type (Max_Size : positive) is new controlled with
record
Actual: prq.LPPQ_Type (Max_Size) ;
end record ;
end Priority_Queue_Cntl_Cntl ;