File: /home/oboss/Users/gec/sources/Basic_Services/Containers/passive_controlled_queue.ads
1 --% Compilation Unit: Passive_Controlled_Queue
2 --
3 --% Category: Generic Package Declaration
4 --
5 --% Release: $Name: $
6 --
7 --% Version: $Revision: 2.1 $
8 --
9 --% Author: $Author: jhl $
10 --
11 --% Revision Log:
12 -- $Log: passive_controlled_queue.ads,v $
13 -- Revision 2.1 2003/10/09 11:05:15 jhl
14 -- Added Service 13 And 19
15 --
16 -- Revision 1.1.2.3 2003/10/08 11:54:33 gec
17 -- Responded to Post-Review comments, i.e. comments to review comments.
18 --
19 -- Revision 1.1.2.2 2003/10/03 10:11:49 jhl
20 -- Large Data Transfer post review updates
21 --
22 -- Revision 1.1.2.1 2003/10/01 11:54:19 jhl
23 -- Initial version of service 13 Event Action, and 19 Large Data Transfer.
24 --
25 -- Revision 2.0 2003/04/04 10:08:58 gec
26 -- Initial release serving as baseline for OBOSS-III project.
27 --
28 -- Revision 1.1.1.1 2003/04/04 07:19:20 gec
29 -- Imported using TkCVS
30 --
31 --
32 --
33 --% Project: OBOSS
34 --
35 --% Copyright (C) 2003 by Terma A/S
36 -- Proprietary and intellectual rights of Terma A/S, Denmark,
37 -- are involved in the subject-matter of this material and
38 -- all manufacturing, reproduction, use, disclosure, and
39 -- sales rights pertaining to such subject-matter are
40 -- expressly reserved. This material is submitted for a
41 -- specific purpose as agreed, and the recipient by
42 -- accepting this material agrees that this material will
43 -- not be used, copied, or reproduced in whole or in part
44 -- nor its contents revealed in any manner or to any person,
45 -- except to meet the purpose for which it was submitted and
46 -- subject to the terms of the agreement.
47 --
48 --% Target Dependencies:
49 -- None
50 --% Compiler Dependencies:
51 -- None
52
53 --~-----------------------------------------------------------------------------
54
55 generic
56
57 --% Generic Parameter Constraints:
58 --> None
59
60 -- Element type stored in queue
61 type Element_Type is private;
62
63 -- Size of queue
64 -- Size 0 is possible.
65 Queue_Size : in Natural;
66
67 -- procedure called on every element in the queue when removing it from the
68 --+ queue in a queue reset
69 with procedure Delete
70 (Element : in out Element_Type);
71
72 package Passive_Controlled_Queue is
73
74 --% Library Package:
75 -- Management of a queue of Element_Type values. The queue implements a
76 --+ passive HRT-HOOD object.
77 --% Active Tasks:
78 --> None
79 --% Passive Tasks:
80 --> None
81
82 -- Raised iff an extract operation is requested on an empty queue.
83 Extract_From_Empty_Queue : exception;
84
85 --% Subprogram:
86 -- Add an element to the queue and report on the success or failure. When
87 --+ the number of elements in the queue equals Queue_Size, calls to
88 --+ Deposit return False and the element will not be inserted in the
89 --+ queue; if the insertion is successful True is returned.
90 --% Parameter Constraints:
91 --> None
92 --% Exceptions Raised:
93 --> None
94
95 function Deposit
96 (Element : in Element_Type)
97 return Boolean;
98
99
100 --% Subprogram:
101 -- Extract the first element from the queue.
102 -- Precondition: Queue must not be empty. If this is violated, then the
103 --+ exception Extract_From_Empty_Queue is raised.
104 --% Parameter Constraints:
105 --> None
106 --% Exceptions Raised:
107 --> Extract_From_Empty_Queue - Raised iff Queue_Is_Empty() = True.
108
109 function Extract
110 return Element_Type;
111
112 --% Subprogram:
113 -- Predicate being true iff the queue is empty.
114 --% Parameter Constraints:
115 --> None
116 --% Exceptions Raised:
117 --> None
118
119 function Queue_Is_Empty
120 return Boolean;
121
122 --% Subprogram:
123 -- Resets the queue, making its size 0.
124 -- All elements in the queue are extracted and Delete are called on
125 --+ them.
126 --% Parameter Constraints:
127 --> None
128 --% Exceptions Raised:
129 --> None
130
131 procedure Reset;
132
133 end Passive_Controlled_Queue;
134
135 --~-----------------------------------------------------------------------------
136