3 -- Grant of Unlimited Rights
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
26 -- FOUNDATION DESCRIPTION:
27 -- This foundation provides a simple background for a class family
28 -- based on an abstract type. It is to be used to test the
29 -- dispatching of various forms of subprogram defined/inherited and
30 -- overridden with the abstract type.
32 -- type procedures functions
33 -- ---- ---------- ---------
34 -- Object Initialize, Swap(abstract) Create(abstract)
35 -- Object'Class Initialized
36 -- Windmill is new Object Swap, Stop, Add_Spin Create, Spin
37 -- Pump is new Windmill Set_Rate Create, Rate
38 -- Mill is new Windmill Swap, Stop Create
41 -- 06 Dec 94 SAIC ACVC 2.0
46 procedure TC_Touch
( A_Tag
: Character );
47 procedure TC_Validate
( Expected
: String; Message
: String );
51 package body F393A00_0
is
52 Expectation
: String(1..20);
53 Finger
: Natural := 0;
55 procedure TC_Touch
( A_Tag
: Character ) is
58 Expectation
(Finger
) := A_Tag
;
61 procedure TC_Validate
( Expected
: String; Message
: String ) is
63 if Expectation
(1..Finger
) /= Expected
then
64 Report
.Failed
( Message
& " Expecting: " & Expected
65 & " Got: " & Expectation
(1..Finger
) );
71 ----------------------------------------------------------------------
74 type Object
is abstract tagged private;
75 procedure Initialize
( An_Object
: in out Object
);
76 function Initialized
( An_Object
: Object
'Class ) return Boolean;
77 procedure Swap
( A
,B
: in out Object
) is abstract;
78 function Create
return Object
is abstract;
80 type Object
is abstract tagged record
81 Initialized
: Boolean := False;
86 package body F393A00_1
is
87 procedure Initialize
( An_Object
: in out Object
) is
89 An_Object
.Initialized
:= True;
90 F393A00_0
.TC_Touch
('a');
93 function Initialized
( An_Object
: Object
'Class ) return Boolean is
95 F393A00_0
.TC_Touch
('b');
96 return An_Object
.Initialized
;
100 ----------------------------------------------------------------------
105 type Rotational_Measurement
is range -1_000
.. 1_000
;
106 type Windmill
is new F393A00_1
.Object
with private;
108 procedure Swap
( A
,B
: in out Windmill
);
110 function Create
return Windmill
;
112 procedure Add_Spin
( To_Mill
: in out Windmill
;
113 RPMs
: in Rotational_Measurement
);
115 procedure Stop
( Mill
: in out Windmill
);
117 function Spin
( Mill
: Windmill
) return Rotational_Measurement
;
120 type Windmill
is new F393A00_1
.Object
with
122 Spin
: Rotational_Measurement
:= 0;
127 package body F393A00_2
is
129 procedure Swap
( A
,B
: in out Windmill
) is
130 T
: constant Windmill
:= B
;
132 F393A00_0
.TC_Touch
('c');
137 function Create
return Windmill
is
140 F393A00_0
.TC_Touch
('d');
144 procedure Add_Spin
( To_Mill
: in out Windmill
;
145 RPMs
: in Rotational_Measurement
) is
147 F393A00_0
.TC_Touch
('e');
148 To_Mill
.Spin
:= To_Mill
.Spin
+ RPMs
;
151 procedure Stop
( Mill
: in out Windmill
) is
153 F393A00_0
.TC_Touch
('f');
157 function Spin
( Mill
: Windmill
) return Rotational_Measurement
is
159 F393A00_0
.TC_Touch
('g');
165 ----------------------------------------------------------------------
169 type Pump
is new F393A00_2
.Windmill
with private;
170 function Create
return Pump
;
172 type Gallons_Per_Revolution
is digits 3;
173 procedure Set_Rate
( A_Pump
: in out Pump
; To_Rate
: Gallons_Per_Revolution
);
174 function Rate
( Of_Pump
: Pump
) return Gallons_Per_Revolution
;
176 type Pump
is new F393A00_2
.Windmill
with
178 GPRPM
: Gallons_Per_Revolution
:= 0.0; -- Gallons/RPM
183 package body F393A00_3
is
184 function Create
return Pump
is
187 F393A00_0
.TC_Touch
('h');
191 procedure Set_Rate
( A_Pump
: in out Pump
; To_Rate
: Gallons_Per_Revolution
)
194 F393A00_0
.TC_Touch
('i');
195 A_Pump
.GPRPM
:= To_Rate
;
198 function Rate
( Of_Pump
: Pump
) return Gallons_Per_Revolution
is
200 F393A00_0
.TC_Touch
('j');
201 return Of_Pump
.GPRPM
;
205 ----------------------------------------------------------------------
210 type Mill
is new F393A00_2
.Windmill
with private;
212 procedure Swap
( A
,B
: in out Mill
);
213 function Create
return Mill
;
214 procedure Stop
( It
: in out Mill
);
216 type Mill
is new F393A00_2
.Windmill
with
218 Pump
: F393A00_3
.Pump
:= F393A00_3
.Create
;
223 package body F393A00_4
is
224 procedure Swap
( A
,B
: in out Mill
) is
225 T
: constant Mill
:= A
;
227 F393A00_0
.TC_Touch
('k');
232 function Create
return Mill
is
235 F393A00_0
.TC_Touch
('l');
239 procedure Stop
( It
: in out Mill
) is
241 F393A00_0
.TC_Touch
('m');
242 F393A00_3
.Stop
( It
.Pump
);
243 F393A00_2
.Stop
( F393A00_2
.Windmill
( It
) );