File: /home/oboss/Users/gec/sources/PUS_Services/Event_Action/event_action-detection_list.ads

1     --% Compilation Unit: Event_Action.Detection_List
2     --
3     --% Category: Generic Package Declaration
4     --
5     --% Release:  $Name:  $
6     --
7     --% Version:  $Revision: 1.2 $
8     --
9     --% Author:   $Author: jhl $
10     --
11     --% Revision Log:
12     --    $Log: event_action-detection_list.ads,v $
13     --    Revision 1.2  2003/10/09 11:05:19  jhl
14     --    Added Service 13 And 19
15     --
16     --    Revision 1.1.2.2  2003/10/06 12:17:17  jhl
17     --    Event Action Post Review first update
18     --
19     --    Revision 1.1.2.1  2003/10/01 11:54:25  jhl
20     --    Initial version of service 13 Event Action, and 19 Large Data Transfer.
21     --
22     --    Revision 2.0  2003/04/04 10:08:58  gec
23     --    Initial release serving as baseline for OBOSS-III project.
24     --
25     --    Revision 1.1.1.1  2003/04/04 07:19:20  gec
26     --    Imported using TkCVS
27     --
28     --
29     --
30     --% Project: OBOSS
31     --
32     --% Copyright (C) 2003 by Terma A/S
33     --  Proprietary and intellectual rights of Terma A/S, Denmark,
34     --  are involved in the subject-matter of this material and
35     --  all manufacturing, reproduction, use, disclosure, and
36     --  sales rights pertaining to such subject-matter are
37     --  expressly reserved. This material is submitted for a
38     --  specific purpose as agreed, and the recipient by
39     --  accepting this material agrees that this material will
40     --  not be used, copied, or reproduced in whole or in part
41     --  nor its contents revealed in any manner or to any person,
42     --  except to meet the purpose for which it was submitted and
43     --  subject to the terms of the agreement.
44     --
45     --% Target Dependencies:
46     --    None
47     --% Compiler Dependencies:
48     --    None
49     
50     --~-----------------------------------------------------------------------------
51     
52     with Task_Priority_Control;
53     with Hashed_Protected_Map_Type;
54     generic
55     
56        --% Generic Parameter Constraints:
57        -->   Detection_List_Priority  - Shall be equal to the ceiling of priorities
58        --+    of all tasks using services from the event action detection list.
59     
60        --% Important:
61        --    It is the responsibility of the user to make sure tha the PUS Packets
62        --+    are allocated (generated) in the system PUS Packet pool before adding
63        --+    them in this list.
64        --    See "PUS_State.ads"
65        --
66        --% Important:
67        -- It is the responsibility of THIS LIST to dispose of PUS Packets removed
68        --+    from the list (when the user calls either Clear_List, Delete_Event or
69        --+    Add_Events which replaces an Action TC).
70     
71        --& Important:
72        -- The functions and procedures in this package are NOT RE-ENTRANT !!!
73     
74        --  Application ID of application process to which this service is
75        --+    associated.
76        Application_Process_ID : in     Mission_Parameters.APID;
77     
78        -- Maximum number of events in event detection list
79        Max_Detection_List_Length : in     Positive;
80     
81        -- Priority of critical region making operations on event detection list
82        --+    data structures atomic
83        Detection_List_Priority
84                                : in     Task_Priority_Control.Passive_Task_Priority;
85     
86     package Event_Action.Detection_List is
87     
88        --% Library Package:
89        --    Implementation of the event detection list for the Event Action
90        --+    service. The manipulation of the list and list elements corresponds
91        --+    to the description of the functionality of the service requests in
92        --+    the ECSS-70-41A PUS standard.
93        --% Active Tasks:
94        -->   None
95        --% Passive Tasks:
96        -->   The_List.Simple_Map - Passive, protecting the elements in the list.
97     
98        -- A look-up operation failed as the given event does not have an entry in
99        --+    the detection list.
100        Not_In_List : exception;
101     
102        -- An insert operation failed as number of list entries has reached
103        --+    Detection_List_Length.
104        List_Length_Exceeded : exception;
105     
106        -- An operation on an the detection list can not be carried out as the
107        --+    Action Status associated with the Event is enabled.
108        Action_Is_Enabled : exception;
109     
110        -- An operation on an the detection list can not be carried out as the
111        --+    Action Status associated with the Event is disabled.
112        Action_Is_Disabled : exception;
113     
114        -- The detection list is too long to be contained in a TM PUS Packet.
115        Detection_List_Too_Long : exception;
116     
117        -- Implementation error. A critical situation which has not been expected in
118        --+    the design has occured.
119        Implementation_Error : exception;
120     
121        -- Type for length of list
122        type List_Length_Type is new Natural range 0 .. Max_Detection_List_Length;
123     
124        -- Normal list operation functions.
125     
126        --% Subprogram:
127        --    Clears the list, resulting in an empty list.
128        --% Parameter Constraints:
129        -->   None
130        --% Exceptions Raised:
131        -->   None
132        procedure Clear_List;
133     
134        --% Subprogram:
135        --    Add an Event and the associated Action TC to the list, and setting the
136        --+    associated Action Status to Disabled.
137        --    If an Action TC in the list is already associated to Event, the Action
138        --+    is replaced iff the Action Status is disabled. Otherwise
139        --+    Action_Is_Enabled is raised.
140        --
141        --    It is not checked that the Action_TC is a TC PUS Packet. This is up to the
142        --+    user of the list.
143        --
144        --% Parameter Constraints:
145        -->   Action_TC - This PUS_Packet shall already have been allocated.
146        --% Exceptions Raised:
147        -->   List_Length_Exceeded - List size is exeeded. Element not inserted.
148        -->   Action_Is_Enabled   - The Event is in the list, and the associated
149        --+    Action Status is enabled. The Event can thus not be replaced.
150        procedure Add_Event
151              (Event     : in     Event_Type;
152               Action_TC : in     PUS.PUS_Packet);
153     
154        --% Subprogram:
155        --    Remove the Event, and Action TC, from the list, iff the associated
156        --+    Action Status is disabled. Otherwise Action_Is_Enabled is raised.
157        --% Parameter Constraints:
158        -->   None
159        --% Exceptions Raised:
160        -->   Action_Is_Enabled   - The Event is in the list, and the associated
161        --+    Action Status is enabled. The Event can thus not be deleted.
162        -->   Not_In_List - List does not contain an entry for Event.
163        procedure Delete_Event
164              (Event : in     Event_Type);
165     
166        --% Subprogram:
167        --    Predicate indicating whether list contains an entry for Event.
168        --% Parameter Constraints:
169        -->   None
170        --% Exceptions Raised:
171        -->   None
172        function Is_In
173              (Event : in     Event_Type)
174              return Boolean;
175     
176        --% Subprogram:
177        --    Sets the Action Status associated to the Event to enabled.
178        --% Parameter Constraints:
179        -->   None
180        --% Exceptions Raised:
181        -->   Not_In_List         - List does not contain an entry for Event.
182        -->   Action_Is_Enabled   - The Event is in the list, and the associated
183        --+    Action Status is already enabled.
184        procedure Enable_Action
185              (Event : in     Event_Type);
186     
187        --% Subprogram:
188        --    Sets the Action Status associated to the Event to disabled.
189        --% Parameter Constraints:
190        -->   None
191        --% Exceptions Raised:
192        -->   Not_In_List          - List does not contain an entry for Event.
193        -->   Action_Is_Disabled   - The Event is in the list, and the associated
194        --+    Action Status is already disabled.
195        procedure Disable_Action
196              (Event : in     Event_Type);
197     
198        --% Subprogram:
199        --    Returns the Action Status assosiated to Event.
200        --
201        --    Mostly used for testing.
202        --% Parameter Constraints:
203        -->   None
204        --% Exceptions Raised:
205        -->   Not_In_List - List does not contain an entry for Event.
206        function Get_Action_Status
207              (Event : in     Event_Type)
208              return Action_Status_Type;
209     
210        --% Subprogram:
211        --    Returns the NOT SHARED Action TC associated to Event.
212        --    Important : The Action TC is not shared.
213        --
214        --    Mostly used for testing.
215        --% Parameter Constraints:
216        -->   None
217        --% Exceptions Raised:
218        -->   Not_In_List - List does not contain an entry for Event.
219        function Get_Action_TC
220              (Event : in     Event_Type)
221              return PUS.PUS_Packet;
222     
223        --% Subprogram:
224        --    Returns the SHARED Action TC associated to Event iff the event is in
225        --+    the list and the action status is enabled.
226        --% Parameter Constraints:
227        -->   None
228        --% Exceptions Raised:
229        -->   Not_In_List - List does not contain an entry for Event.
230        -->   Action_Is_Disabled - The event is in the list, but the action status
231        --+    is disabled.
232        function Get_Action
233              (Event : in     Event_Type)
234              return PUS.PUS_Packet;
235     
236        --% Subprogram:
237        --    Returns a PUS packet where the source data has been set to contain a
238        --+    report of the contents of the detection list.
239        --    See ECSS-E-70-41A for description of the report format.
240        --
241        --    Note:
242        --    This function is on a different abstraction level
243        --+    than the other functions in this package.
244        --% Parameter Constraints:
245        -->   None
246        --% Exceptions Raised:
247        -->   Detection_List_Too_Long -- The detection list is too long to be
248        --+    contained in a TM PUS Packet.
249        -->   Source_Data_Stream.No_Streams_Available -- No source data stream available
250        --+    to hold source data for report.
251        function Generate_Detection_List_Report_PUS_Packet
252              return PUS.PUS_Packet;
253     
254        --% Subprogram:
255        --    Returns the detection list length
256        --% Parameter Constraints:
257        -->   None
258        --% Exceptions Raised:
259        -->   Implementation_Error - List is changing while calculating list length
260     
261        function Get_Detection_List_Length
262              return List_Length_Type;
263     
264     end Event_Action.detection_List;
265     
266     --~-----------------------------------------------------------------------------
267