File: /home/oboss/Users/gec/sources/PUS_Services/Large_Data_Transfer/large_data_transfer-sdu_parts.ads

1     --% Compilation Unit: Large_Data_Transfer.Sdu_Parts
2     --
3     --% Category: Generic Package Declaration
4     --
5     --% Release:  $Name:  $
6     --
7     --% Version:  $Revision: 1.3 $
8     --
9     --% Author:   $Author: gec $
10     --
11     --% Revision Log:
12     --    $Log: large_data_transfer-sdu_parts.ads,v $
13     --    Revision 1.3  2004/02/13 16:17:19  gec
14     --    Merged results of Demonstrator development on to main OBOSS trunk.
15     --
16     --    Revision 1.2.8.1  2004/02/05 11:36:58  gec
17     --    Corrected erroneous default value for SDU part data length.
18     --
19     --    Revision 1.2  2003/10/09 11:05:30  jhl
20     --    Added Service 13 And 19
21     --
22     --    Revision 1.1.2.3  2003/10/08 15:35:00  jhl
23     --    Changed SDU Parts pacakge to store read streams instead of write
24     --+    streams.
25     --    Corrected Receiver State to correctly deallocate all streams after trying
26     --+    to add them to the SDU Parts map.
27     --    Updated TC Parsed and Reveicer State to utilize ned SDU Parts.
28     --
29     --    Revision 1.1.2.2  2003/10/03 09:47:57  jhl
30     --    Large Data Transfer post review first update
31     --
32     --    Revision 1.1.2.1  2003/10/01 11:54:44  jhl
33     --    Initial version of service 13 Event Action, and 19 Large Data Transfer.
34     --
35     --    Revision 2.0  2003/04/04 10:08:58  gec
36     --    Initial release serving as baseline for OBOSS-III project.
37     --
38     --    Revision 1.1.1.1  2003/04/04 07:19:20  gec
39     --    Imported using TkCVS
40     --
41     --
42     --
43     --% Project: OBOSS
44     --
45     --% Copyright (C) 2003 by Terma A/S
46     --  Proprietary and intellectual rights of Terma A/S, Denmark,
47     --  are involved in the subject-matter of this material and
48     --  all manufacturing, reproduction, use, disclosure, and
49     --  sales rights pertaining to such subject-matter are
50     --  expressly reserved. This material is submitted for a
51     --  specific purpose as agreed, and the recipient by
52     --  accepting this material agrees that this material will
53     --  not be used, copied, or reproduced in whole or in part
54     --  nor its contents revealed in any manner or to any person,
55     --  except to meet the purpose for which it was submitted and
56     --  subject to the terms of the agreement.
57     --
58     --% Target Dependencies:
59     --    None
60     --% Compiler Dependencies:
61     --    None
62     
63     --~-----------------------------------------------------------------------------
64     
65     with Source_Data_Stream;
66     with External_Large_Data_Transfer_Types;
67     
68     generic package Large_Data_Transfer.SDU_Parts is
69     
70        --% Library Package:
71        --    Specialized unprotected package managing the storage, and assembling,
72        --+    of SDU parts.
73        --
74        --    SDU Parts added to the storage by the Insert_command is either
75        --+    _inserted_ or _inserted as missing_.
76        --
77        --    A part is _inserted_ iff:
78        --    1) The part is not already inserted or missing in the storage area.
79        --    2) The part number is in the valid part number range.
80        --    3) The write stream is allocated and of the correct specified length.
81        --    A part is _inserted as missing_ iff:
82        --    1) It is not inserted.
83        --
84        --    Only parts not alreay _inserted_ or _inserted as missing_ can be added
85        --+    to the storage.
86        --
87        --    Only parts not already _inserted_ or _inserted as missing_ can be
88        --+    inserted as missing
89        --
90        --    Only parts already _inserted as missing_ can be replaced by the
91        --+    Replace command.
92        --
93        --% Active Tasks:
94        -->   None
95        --% Passive Tasks:
96        -->   None
97     
98        -- The part has already been inserted or inserted as missing.
99        Already_Inserted : exception;
100     
101        -- The part to be replaced has not been inserted before, and is hence not
102        --+    missing.
103        Not_Inserted : exception;
104     
105        -- Assembling of the SDU failed due to missing parts.
106        Part_Missing : exception;
107     
108        -- Array type for missing parts
109        type Missing_Parts_Array is array (Natural range <>) of
110              Large_Data_Transfer.Part_Range;
111     
112        --% Subprogram:
113        --    Initializes the parts list
114        --% Parameter Constraints:
115        -->   None
116        --% Exceptions Raised:
117        -->   None
118     
119        procedure Initialize;
120     
121        --% Subprogram:
122        --    Clear all parts and missing parts from the parts list, deallocating
123        --+    all streams.
124        --% Parameter Constraints:
125        -->   None
126        --% Exceptions Raised:
127        -->   None
128     
129        procedure Clear_Parts;
130     
131        --% Subprogram:
132        --    Inserts a part, write stream, in the storage.
133        --    Returns true when the stream has been shared and inserted.
134        --    If the stream bit length is not of the specified Byte_Length (passed
135        --+    as parameter), is not allocated, the part is inserted as missing, and
136        --+    False is returned.
137        --    (I.e. only bit streams with an integer number of bytes in the stream
138        --+    can be inserted.)
139        --% Parameter Constraints:
140        -->   None
141        --% Exceptions Raised:
142        -->   Already_Inserted - the part has already been inserted or inserted as
143        --+    missing,
144     
145        function Add_Part
146              (Part        : in     Large_Data_Transfer.Part_Range;
147               Stream      : in     Source_Data_Stream.Read_Stream;
148               Byte_Length : in     Large_Data_Transfer.Optional_Part_Byte_Range :=
149                     External_Large_Data_Transfer_Types.SDU_Part_Byte_Size)
150              return Boolean;
151     
152        --% Subprogram:
153        --    Inserts a part number as missing.
154        --% Parameter Constraints:
155        -->   None
156        --% Exceptions Raised:
157        -->   Already_Inserted - the part has already been inserted or inserted as
158        --+    missing
159     
160        procedure Add_Part_As_Missing
161              (Part : in     Large_Data_Transfer.Part_Range);
162     
163        --% Subprogram:
164        --    Replaces a previously _inserted as missing_ part.
165        --    Returns true when the stream has been shared and inserted.
166        --    If the part is already inserted, False is returned.
167        --    If the part is not already inserted as missing, False is returned.
168        --    If the stream bit length is not of the specified byte length, or is
169        --+    not allocated, False is returned.
170        --    I.e. only streams with an integer number of bytes in the stream can be
171        --+    inserted.
172        --% Parameter Constraints:
173        -->   None
174        --% Exceptions Raised:
175        -->   Not_Inserted_As_Missing - The part has not been inserted as missing.
176     
177        function Add_Missing_Part
178              (Part        : in     Large_Data_Transfer.Part_Range;
179               Stream      : in     Source_Data_Stream.Read_Stream;
180               Byte_Length : in     Large_Data_Transfer.Optional_Part_Byte_Range :=
181                     External_Large_Data_Transfer_Types.SDU_Part_Byte_Size)
182              return Boolean;
183     
184        --% Subprogram:
185        --    Assembles the SDU parts into an SDU byte array.
186        --% Parameter Constraints:
187        -->   None
188        --% Exceptions Raised:
189        -->   Part_Missing - A missing part prevented the SDU from being assembled.
190     
191        function Assemble_SDU_Byte_Array
192              (Last_Part : in     Large_Data_Transfer.Part_Range)
193              return Basic_Types.Byte_Array;
194     
195        --% Subprogram:
196        --    Returns an array saying which parts are inserted as missing up to, and
197        --+    including, the last part.
198        --% Parameter Constraints:
199        -->   None
200        --% Exceptions Raised:
201        -->   None
202     
203        function Get_Missing_Parts
204              (Last_Part : in     Large_Data_Transfer.Part_Range)
205              return Missing_Parts_Array;
206     
207     end Large_Data_Transfer.sdu_Parts;
208     
209     --~-----------------------------------------------------------------------------
210