From: okellogg@my-dejanews.com
Subject: What's wrong with this code?
Date: 1999/04/20
Date: 1999-04-20T00:00:00+00:00 [thread overview]
Message-ID: <7fi85m$sb3$1@nnrp1.dejanews.com> (raw)
Dear colleagues:
I can't find what wrong with this code (see full declaration of type Alarm.)
Perhaps someone would like to comment?
Thanks alot,
Oliver Kellogg
DaimlerChrysler Aerospace
Sensor Systems, Dept. VGE15
D-89070 Ulm, Germany
e-mail: oliver.kellogg@vs.dasa.de
--
-- file: alarm_model.ads
package Alarm_Model is
type Alarm is tagged limited private;
type Alarm_P is access all Alarm'Class;
procedure Norm (This : access Alarm'Class);
private
type Alarm_State_Et is
(Snafu, Data, Proposal);
type Alarm_State (My_Alarm : access Alarm) is
abstract tagged limited null record;
type Alarm_State_P is access all Alarm_State'Class;
type Alarm_State_Pool_At is
array (Alarm_State_Et) of Alarm_State_P;
procedure Enter (This : access Alarm_State);
type Snafu_State is new Alarm_State with null record;
type Snafu_State_P is access all Snafu_State'Class;
procedure Request_Data (This : access Snafu_State);
type Data_State is new Alarm_State with null record;
type Data_State_P is access all Data_State'Class;
type Proposal_State is new Alarm_State with null record;
type Proposal_State_P is access all Proposal_State'Class;
protected type Alarm_Semaphore (My_Alarm : access Alarm) is
function Get return Alarm_State_P;
procedure Set (New_State : in Alarm_State_Et);
private
Current_State : Alarm_State_Et := Snafu;
----------------------------- This is the workaround used
-- Alarm_State_Pool : Alarm_State_Pool_At :=
-- (Snafu => new Snafu_State (My_Alarm),
-- Data => new Data_State (My_Alarm),
-- Proposal => new Proposal_State (My_Alarm));
end Alarm_Semaphore;
type Alarm is tagged limited
record
-- This compiles alright:
Semaphore : Alarm_Semaphore (Alarm'Access);
-- But here, GNAT 3.11p says:
-- "Access" attribute cannot be applied to type
Alarm_State_Pool : Alarm_State_Pool_At :=
(Snafu => new Snafu_State (Alarm'Access),
Data => new Data_State (Alarm'Access),
Proposal => new Proposal_State (Alarm'Access));
end record;
end Alarm_Model;
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
next reply other threads:[~1999-04-20 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-20 0:00 okellogg [this message]
1999-04-20 0:00 ` What's wrong with this code? dennison
1999-04-20 0:00 ` dennison
1999-04-20 0:00 ` Matthew Heaney
1999-04-21 0:00 ` dennison
1999-04-20 0:00 ` Matthew Heaney
1999-04-21 0:00 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox