File: /home/oboss/Users/gec/sources/Basic_Services/Source_Data/cell_pool.ads

1     --% Compilation Unit:	Cell_Pool
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: cell_pool.ads,v $
13     --    Revision 2.1  2003/07/04 09:53:39  gec
14     --    Corrected erroenous comment on Allocate operation.
15     --
16     --    Revision 2.0  2003/04/04 08:50:13  gec
17     --    Initial release of source files serving as baseline for OBOSS-III project.
18     --
19     --    Revision 1.1.1.1  2003/04/04 08:13:03  gec
20     --    Imported using TkCVS
21     --
22     --
23     --
24     --% Project: OBOSS
25     --
26     --% Copyright (C) 2003 by Terma A/S
27     --  Proprietary and intellectual rights of Terma A/S, Denmark,
28     --  are involved in the subject-matter of this material and
29     --  all manufacturing, reproduction, use, disclosure, and
30     --  sales rights pertaining to such subject-matter are
31     --  expressly reserved. This material is submitted for a
32     --  specific purpose as agreed, and the recipient by
33     --  accepting this material agrees that this material will
34     --  not be used, copied, or reproduced in whole or in part
35     --  nor its contents revealed in any manner or to any person,
36     --  except to meet the purpose for which it was submitted and
37     --  subject to the terms of the agreement.
38     --
39     --% Target Dependencies:
40     --    None
41     --% Compiler Dependencies:
42     --    None
43     
44     --~-----------------------------------------------------------------------------
45     
46     with Cell_Package;
47     with Task_Priority_Control;
48     generic
49     
50        --% Generic Parameter Constraints:
51        -->   Pool_Manager_Priority  -  Must be higher than ceiling of priorities of
52        --+    all tasks calling provided operations
53     
54        -- References to storage cells contained in pool.
55        type Key is (<>);
56     
57        -- Size of storage cells.
58        Bit_Size : in     Positive;
59     
60        -- Priority assigned to task implementing critical region around operations
61        --+    of cell pool.
62        Pool_Manager_Priority : in     Task_Priority_Control.Passive_Task_Priority;
63     
64     package Cell_Pool is
65     
66        --% Library Package:
67        --    Manages pool of memory cells with size given by Bit_Size.
68        --    Key is reference to cells and one memory cell will be associated to
69        --+    each value in Key'range.
70        --% Active Tasks:
71        --    None
72        --% Passive Tasks:
73        -->   Store_Manager.Allocator - Description
74     
75        -- Not_Allocated indicates that an operation has been performed on an
76        --+    unallocated cell.
77        Not_Allocated : exception;
78     
79        -- No_Cells_Available indicates that an Allocate operation has failed due to
80        --+    lack of free cells.
81        No_Cells_Available : exception;
82     
83        --% Subprogram:
84        --    Allocate a memory cell from pool of unused cells.
85        --% Parameter Constraints:
86        -->   None
87        --% Exceptions Raised:
88        -->   No_Cells_Available - No free cells to allocate.
89        function Allocate
90              return Key;
91     
92        --% Subprogram:
93        --    Release the memory cell reference K using reference counting (re.
94        --+    Share).
95        --% Parameter Constraints:
96        -->   None
97        --% Exceptions Raised:
98        -->   Not_Allocated - K is not in the list of allocated cells.
99        procedure Deallocate
100              (K : in     Key);
101     
102        --% Subprogram:
103        --    Share the reference K.
104        --    Reference count will be incremented.
105        --% Parameter Constraints:
106        -->   None
107        --% Exceptions Raised:
108        -->   Not_Allocated - K is not in the list of allocated cells.
109        procedure Share
110              (K : in     Key);
111     
112        --% Subprogram:
113        --    Dereference the reference K returning the address to the associated
114        --+    memory cell.
115        --% Parameter Constraints:
116        -->   None
117        --% Exceptions Raised:
118        -->   Not_Allocated - K is not in the list of allocated cells.
119        function Dereference
120              (K :        Key)
121              return Cell_Package.Cell_Ref;
122     
123        --% Subprogram:
124        --    Dereference the reference K returning the address to the associated
125        --+    memory cell.
126        --% Parameter Constraints:
127        -->   K must be in the list of allocated cells.
128        --% Exceptions Raised:
129        -->   None
130        function Dereference_Safe
131              (K :        Key)
132              return Cell_Package.Cell_Ref;
133     
134     end Cell_Pool;
135     
136     --~-----------------------------------------------------------------------------
137