File: /home/oboss/Users/gec/sources/Basic_Services/Containers/queue.ads
1 --% Compilation Unit: Queue
2 --
3 --% Category: Generic Package Declaration
4 --
5 --% Release: $Name: $
6 --
7 --% Version: $Revision: 2.0 $
8 --
9 --% Author: $Author: gec $
10 --
11 --% Revision Log:
12 -- $Log: queue.ads,v $
13 -- Revision 2.0 2003/04/04 08:49:57 gec
14 -- Initial release of source files serving as baseline for OBOSS-III project.
15 --
16 -- Revision 1.1.1.1 2003/04/04 08:13:00 gec
17 -- Imported using TkCVS
18 --
19 --
20 --
21 --% Project: OBOSS
22 --
23 --% Copyright (C) 2003 by Terma A/S
24 -- Proprietary and intellectual rights of Terma A/S, Denmark,
25 -- are involved in the subject-matter of this material and
26 -- all manufacturing, reproduction, use, disclosure, and
27 -- sales rights pertaining to such subject-matter are
28 -- expressly reserved. This material is submitted for a
29 -- specific purpose as agreed, and the recipient by
30 -- accepting this material agrees that this material will
31 -- not be used, copied, or reproduced in whole or in part
32 -- nor its contents revealed in any manner or to any person,
33 -- except to meet the purpose for which it was submitted and
34 -- subject to the terms of the agreement.
35 --
36 --% Target Dependencies:
37 -- None
38 --% Compiler Dependencies:
39 -- None
40
41 --~-----------------------------------------------------------------------------
42
43 with Task_Priority_Control;
44 generic
45
46 --% Generic Parameter Constraints:
47 --> Queue_Task_Priority - Shall at least be the ceiling of priorities of
48 --+ all tasks using services from the queue
49
50 type Element_Type is private;
51 Queue_Size : in Natural;
52
53 -- Priority of protected object implementing queue
54 Queue_Priority : in Task_Priority_Control.Passive_Task_Priority;
55
56 package Queue is
57
58 --% Library Package:
59 -- Management of a queue of Element_Type values. The queue implements a
60 --+ synchronisation protected HRT-HOOD object.
61 --% Active Tasks:
62 --> None
63 --% Passive Tasks:
64 --> Queue_Task - Protection of of the queue state
65
66 --% Subprogram:
67 -- Add an element to the queue and report on the success or failure. When
68 --+ the number of elements in the queue equals Queue_Size, calls to
69 --+ Deposit return False and the element will not be inserted in the
70 --+ queue; if the insertion is successful True is returned.
71 --% Parameter Constraints:
72 --> None
73 --% Exceptions Raised:
74 --> None
75
76 function Deposit
77 (Elem : in Element_Type)
78 return Boolean;
79
80
81 --% Subprogram:
82 -- Extract the first element from the queue. When the queue is empty, the
83 --+ caller will be suspended until an element has been inserted.
84 --% Parameter Constraints:
85 --> None
86 --% Exceptions Raised:
87 --> None
88
89 function Extract
90 return Element_Type;
91
92 end Queue;
93
94 --~-----------------------------------------------------------------------------
95