comp.lang.ada
 help / color / mirror / Atom feed
From: "stuart clark" <stuart.clark@baesystems.com>
Subject: Discriminant within discriminants
Date: 2 May 2006 18:49:13 -0700
Date: 2006-05-02T18:49:13-07:00	[thread overview]
Message-ID: <1146620953.878484.308430@i40g2000cwc.googlegroups.com> (raw)

I have a the following

package message_types

  type id_type is range 1..8;

 type dispense_ack (size:id_type:=id_Type'first) is
   record
     dispense_acks:array(1..size) of acks;
   end record;

  type message_types(dispense_acknowledgement, dispense_request);

  type in_messages(kind :msg_types:=msg_types'first) is
   record
    case type is
      when dispense_acknowledgement =>
         acknowledgements:dispense_ack;
      when dispense_request
         request:integer;
    end case
  end record;

end message_types;

i want to declare a message that is of dispense_acknowledgment type
with a size of 8

i can do

msg:message_types.in_messages(kind=>message_types.dispense_acknowledgment);

this gives me the correct message type but as the dispense_ack is
defaulted to size=1
i get a message of size 1.

the only way i can get my code to compile with a message size of 8 is
to use

declare
  msg:message_types.in_messages;
  dispense_ack_msg:message_types.dispense_ack(size=>8);
begin
  msg:=(kind=>message_types.dispense_acknowledgement,
            acknowledgements=>dispense_ack_msg);

end;

QUESTION : can i declare a message with a type and size in the one
statement without using the intermediate message.




             reply	other threads:[~2006-05-03  1:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-03  1:49 stuart clark [this message]
2006-05-03 16:45 ` Discriminant within discriminants Jeffrey R. Carter
2006-05-03 21:05   ` Randy Brukardt
2006-05-04  0:14     ` stuart clark
2006-05-04  0:57       ` Jeffrey R. Carter
     [not found]         ` <4a9k52ha4ohqkcd01ghn6c7785d6pvf91e@4ax.com>
2006-05-04 17:57           ` Jeffrey R. Carter
2006-05-04  0:45     ` Jeffrey R. Carter
2006-05-05  9:03 ` 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