File: /home/oboss/Users/gec/sources/PUS_Services/Storage_And_Retrieval/mass_store.ads
1 --% Compilation Unit: Mass_Store
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: mass_store.ads,v $
13 -- Revision 2.1 2003/10/21 08:44:52 gec
14 -- Merged STADY_Recommendations branch onto trunk.
15 -- Contains numerous updates resulting from STADY fault descriptions.
16 --
17 -- Revision 2.0.2.1 2003/10/13 12:46:04 gec
18 -- Modified type for formal generic parameter Mass_Storage.Max_Elements from Natural to Positive.
19 -- Instantiating with Max_Elements => 0 would result in constraint error.
20 --
21 -- Response to STADY faul description Fault 15.
22 --
23 -- Revision 2.0 2003/04/04 08:51:20 gec
24 -- Initial release of source files serving as baseline for OBOSS-III
25 --+ project.
26 --
27 -- Revision 1.1.1.1 2003/04/04 08:13:14 gec
28 -- Imported using TkCVS
29 --
30 --
31 --
32 --% Project: OBOSS
33 --
34 --% Copyright (C) 2003 by Terma A/S
35 -- Proprietary and intellectual rights of Terma A/S, Denmark,
36 -- are involved in the subject-matter of this material and
37 -- all manufacturing, reproduction, use, disclosure, and
38 -- sales rights pertaining to such subject-matter are
39 -- expressly reserved. This material is submitted for a
40 -- specific purpose as agreed, and the recipient by
41 -- accepting this material agrees that this material will
42 -- not be used, copied, or reproduced in whole or in part
43 -- nor its contents revealed in any manner or to any person,
44 -- except to meet the purpose for which it was submitted and
45 -- subject to the terms of the agreement.
46 --
47 --% Target Dependencies:
48 -- None
49 --% Compiler Dependencies:
50 -- None
51
52 --~-----------------------------------------------------------------------------
53
54 generic
55
56 --% Generic Parameter Constraints:
57 --> None
58
59 type Element is private;
60 Max_Elements : in Positive;
61
62 package Mass_Store is
63
64 --% Library Package:
65 -- Management of stores of indexed elements
66 --% Active Tasks:
67 --> None
68 --% Passive Tasks:
69 --> None
70
71 type Index_Type is private;
72 Start_Index : constant Index_Type;
73
74
75 --% Subprogram:
76 -- Read an element from a given position
77 --% Parameter Constraints:
78 --> None
79 --% Exceptions Raised:
80 --> None
81
82 procedure Read
83 (Index : in Index_Type;
84 Item : out Element);
85
86
87 --% Subprogram:
88 -- Write an element to a given position
89 --% Parameter Constraints:
90 --> None
91 --% Exceptions Raised:
92 --> None
93
94 procedure Write
95 (Index : in Index_Type;
96 Item : in Element);
97
98
99 --% Subprogram:
100 -- Increments Index modulo Index_Type'Last
101 --% Parameter Constraints:
102 --> None
103 --% Exceptions Raised:
104 --> None
105
106 procedure Inc
107 (Index : in out Index_Type);
108
109
110 --% Subprogram:
111 -- Decrements Index modulo Index_Type'Last
112 --% Parameter Constraints:
113 --> None
114 --% Exceptions Raised:
115 --> None
116
117 procedure Dec
118 (Index : in out Index_Type);
119
120
121 --% Subprogram:
122 -- Finds the middle between L and the predecessor of R (all modulo
123 --+ Index_Type'Last) and prepares the local state for either Search_Left
124 --+ or Search_Right
125 --% Parameter Constraints:
126 --> None
127 --% Exceptions Raised:
128 --> None
129
130 function Binary_Search
131 (L, R : in Index_Type)
132 return Index_Type;
133
134
135 --% Subprogram:
136 -- Finds the middle of the left half of the current interval represented
137 --+ in the local state
138 --% Parameter Constraints:
139 --> None
140 --% Exceptions Raised:
141 --> None
142
143 function Search_Left
144 return Index_Type;
145
146
147 --% Subprogram:
148 -- Finds the middle of the right half of the current interval represented
149 --+ in the local state
150 --% Parameter Constraints:
151 --> None
152 --% Exceptions Raised:
153 --> None
154
155 function Search_Right
156 return Index_Type;
157
158
159 --% Subprogram:
160 -- Determines whether the binary search is completed
161 --% Parameter Constraints:
162 --> None
163 --% Exceptions Raised:
164 --> None
165
166 function Done_Search
167 return Boolean;
168
169 private
170
171 type Index_Type is new Natural range 0 .. Max_Elements - 1;
172 Start_Index : constant Index_Type := Index_Type'First;
173
174 end Mass_Store;
175
176 --~-----------------------------------------------------------------------------
177