From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Access type problem.
Date: 1998/08/20
Date: 1998-08-20T00:00:00+00:00 [thread overview]
Message-ID: <6rhrhr$mhe@hacgate2.hac.com> (raw)
In-Reply-To: 35DC295E.D6A41D97@hiwaay.net
Barry L. Dorough wrote in message <35DC295E.D6A41D97@hiwaay.net>...
> I have some code where I have been carrying extra records around
>because I don't know how to make the proper access type assignment. Any
>help would be greatly appreciated.
>
Here is your example, modified so it will compile.
The four changed lines are commented
-- begin source code --
package Dorough is
type Track_Data_Type is record
Threat_Number : Integer;
Threat_Id : Integer;
X : Long_Float;
Y : Long_Float;
Z : Long_Float;
end record;
type Track_Data_Access is access all Track_Data_Type; -- changed --
type Track_Data_Array is array (Integer range <>) of aliased
Track_Data_Type; -- changed
type Track_Data_Array_Access is access Track_Data_Array;
type Map_Type is record
Int_Obj : Track_Data_Array_Access := new Track_Data_Array(1..10);
-- In reality this is allocated dynamically based on current air
picture
Tgt_Obj : Track_Data_Array_Access:= new Track_Data_Array(1..10);
-- In reality this is allocated dynamically based on current air
picture
end record;
type Current_Pair_Type is record
Interceptor : Track_Data_Access;
Target : Track_Data_Access;
end record;
-- In reality there is a Current_Pair_Type allocated for each pairing
saved in a linked list
procedure Assign_Current_Pair( Map : in Map_Type;
Int_Index : in
Integer;
Tgt_Index: in Integer;
Pair : in out
Current_Pair_Type);
end Dorough;
package body Dorough is
procedure Assign_Current_Pair( Map : in Map_Type;
Int_Index : in
Integer;
Tgt_Index: in Integer;
Pair : in out
Current_Pair_Type) is
begin
-- This is the crux of my problem. At present the Current_Pair_Type
has
-- Track_Data_Type instead of Track_Data_Access and my code looks like
Pair.Interceptor := Map.Int_Obj (Int_Index) 'access; -- changed
Pair.Target := Map.Tgt_Obj (Tgt_Index) 'access; -- changed
-- I would have thought that this would work with the access types
also, But
-- I get type miss match errors.
end Assign_Current_Pair;
end Dorough;
-- end source code --
David C. Hoos, Sr.
prev parent reply other threads:[~1998-08-20 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-08-20 0:00 Access type problem Barry L. Dorough
1998-08-20 0:00 ` David C. Hoos, Sr. [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox