comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Variant records..
Date: 16 Feb 2004 20:14:42 +0000
Date: 2004-02-16T20:14:42+00:00	[thread overview]
Message-ID: <x7vwu6mwzm5.fsf@smaug.pushface.org> (raw)
In-Reply-To: e8f9995c.0402160859.31ea9a85@posting.google.com

ganesh.ramasivan@gdcanada.com (Ganesh Ramasivan) writes:

> type RADAR_TYPE_CHOICE is (RADAR_A, RADAR_B, RADAR_C);
>     
> type RADAR_A_COMMAND_CHOICE is (RADAR_A_STATE,
>                                 RADAR_A_MODE,
>                                 RADAR_A_DISPLAY_RANGE_SELECT);
>                                       
> type RADAR_B_COMMAND_CHOICE is (RADAR_B_STATE,
>                                 RADAR_B_MODE,
>                                 RADAR_B_DISPLAY_RANGE_SELECT);
> 
> type RADAR_C_COMMAND_CHOICE is (RADAR_C_STATE,
>                                 RADAR_C_MODE,
>                                 RADAR_C_DISPLAY_RANGE_SELECT);

I would say you seem to have a basic concept Radar with a set of
Commands that might apply to any Radar, and three instances of Radar.

   type Radar_Kind is (Radar_A, Radar_B, Radar_C);
   type Radar_Command is (State, Mode, Display_Range_Select);

I can see that you might have different sets of states for Radar_A
than those for Radar_B, but so far your code doesn't say that.

> type RADAR_CHOICE(RADAR_TYPE : RADAR_TYPE_CHOICE :=
> RADAR_TYPE_CHOICE'FIRST) is
>       record   
>         case RADAR_TYPE is
>     	  when  RADAR_A =>
>             null;
>     	  when  RADAR_B  =>
>             null;
>     	  when  RADAR_C =>
>             null;            
>         end case;
>       end record;
> 
> How would I specify a variant record which will only allow me to
> select RADAR_A for the RADAR_TYPE_CHOICE and RADAR_A_STATE for the
> command choice but not RADAR_C_STATE?

I don't see any command choice here?

I don't really grasp why you want this Radar_Choice thing, perhaps it
would help if you could say what you would like to appear in the
places you've marked 'null' ... is it

type RADAR_CHOICE
  (RADAR_TYPE : RADAR_TYPE_CHOICE := RADAR_TYPE_CHOICE'FIRST) is
      record   
        case RADAR_TYPE is
    	  when  RADAR_A =>
            Radar_A_Command : Radar_A_Command_Choice;
    	  when  RADAR_B  =>
            Radar_B_Command : Radar_B_Command_Choice;
    	  when  RADAR_C =>
            Radar_C_Command : Radar_C_Command_Choice;
        end case;
      end record;



Sorry that I'm querying your design intent rather than your actual
question, I haven't understood the question properly!

-- 
Simon Wright                               100% Ada, no bugs.



  reply	other threads:[~2004-02-16 20:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-15 22:51 Variant records Ganesh Ramasivan
2004-02-16 10:57 ` Preben Randhol
2004-02-16 15:25   ` Ganesh Ramasivan
2004-02-16 15:46     ` Ludovic Brenta
2004-02-16 16:16     ` Preben Randhol
2004-02-17 14:37       ` Ganesh Ramasivan
2004-02-17 15:43         ` Preben Randhol
2004-02-16 16:59   ` Ganesh Ramasivan
2004-02-16 20:14     ` Simon Wright [this message]
2004-02-17 14:56       ` Ganesh Ramasivan
2004-02-17 15:31         ` Robert I. Eachus
2004-02-16 23:17 ` tmoran
  -- strict thread matches above, loose matches on Subject: below --
1999-09-14  0:00 Variant Records Shawn Barber
1999-09-14  0:00 ` Mark Lundquist
1999-09-14  0:00 ` David C. Hoos, Sr.
1999-09-14  0:00 ` Matthew Heaney
1986-10-31  9:08 variant records Dean Luick
1986-11-03 14:17 ` Bev Sobelman
1986-11-05 16:35 ` stuart
1986-11-06 15:40 ` stt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox