File: /home/oboss/Users/gec/sources/Basic_Services/Containers/circular_buffer.ads
1 --% Compilation Unit: Circular_Buffer
2 --
3 --% Category: Generic Package Declaration
4 --
5 --% Release: $Name: $
6 --
7 --% Version: $Revision: 2.1 $
8 --
9 --% Author: $Author: gec $
10 --
11 --% Revision Log:
12 -- $Log: circular_buffer.ads,v $
13 -- Revision 2.1 2003/10/21 11:58:41 gec
14 -- Eliminated work arounds originating from restrictions on passive tasks in the Adaworld compiler.
15 --
16 -- Revision 2.0 2003/04/04 08:49:55 gec
17 -- Initial release of source files serving as baseline for OBOSS-III
18 --+ project.
19 --
20 -- Revision 1.1.1.1 2003/04/04 08:13:00 gec
21 -- Imported using TkCVS
22 --
23 --
24 --
25 --% Project: OBOSS
26 --
27 --% Copyright (C) 2003 by Terma A/S
28 -- Proprietary and intellectual rights of Terma A/S, Denmark,
29 -- are involved in the subject-matter of this material and
30 -- all manufacturing, reproduction, use, disclosure, and
31 -- sales rights pertaining to such subject-matter are
32 -- expressly reserved. This material is submitted for a
33 -- specific purpose as agreed, and the recipient by
34 -- accepting this material agrees that this material will
35 -- not be used, copied, or reproduced in whole or in part
36 -- nor its contents revealed in any manner or to any person,
37 -- except to meet the purpose for which it was submitted and
38 -- subject to the terms of the agreement.
39 --
40 --% Target Dependencies:
41 -- None
42 --% Compiler Dependencies:
43 -- None
44
45 --~-----------------------------------------------------------------------------
46
47 with Task_Priority_Control;
48 generic
49
50 --% Generic Parameter Constraints:
51 --> Queue_Task_Priority - Shall at least be the ceiling of priorities of
52 --+ all tasks using services from the queue
53
54 type Element_Type is private;
55 type Element_Type_Array is array (Natural range <>) of Element_Type;
56 Buffer_Size : Positive;
57 Buffer_Priority : in Task_Priority_Control.Passive_Task_Priority;
58
59 package Circular_Buffer is
60
61 --% Library Package:
62 -- Implements a circular buffer
63 --% Active Tasks:
64 --> None
65 --% Passive Tasks:
66 --> Buffer_Task - Critical region for updating buffer
67
68 Not_Enough_Elements_In_Buffer : exception;
69
70 --% Subprogram:
71 -- Puts a single element into the buffer
72 --% Parameter Constraints:
73 --% Exceptions Raised:
74 --> None
75 function Put
76 (Elem : in Element_Type)
77 return Boolean;
78
79 --% Subprogram:
80 -- Puts an array of elements into the buffer
81 --% Parameter Constraints:
82 --> parameter_name - Constraints
83 --% Exceptions Raised:
84 --> None
85
86 function Put
87 (Elem_Array : in Element_Type_Array)
88 return Boolean;
89
90
91 --% Subprogram:
92 -- Gets a single element
93 --% Parameter Constraints:
94 --> parameter_name - Constraints
95 --% Exceptions Raised:
96 --> Not_Enough_Elements_In_Buffer
97 function Get_Single_Element
98 return Element_Type;
99
100 --% Subprogram:
101 -- Gets an array of elements from the buffer
102 --% Parameter Constraints:
103 --> parameter_name - Constraints
104 --% Exceptions Raised:
105 --> Not_Enough_Elements_In_Buffer
106 function Get
107 (Number_Of_Bytes : in Positive)
108 return Element_Type_Array;
109
110 end Circular_Buffer;
111
112 --~-----------------------------------------------------------------------------
113