Fri, 31 Aug 2001 00:17:12 -0700
You are doing the right thing.
Don't be confused about the 'Pos attribute however.
It returs the ordinal postion in the range of the type,
ie: 0..n-1 where n is the number of distinct values
of the type.
Your representation specification will ensure that values
of the type are stored using the values you want.
From: Krishna, Buska (IE10)
To: [log in to unmask]
Sent: 8/31/2001 1:47 AM
Subject: Referring Enum values.
I have written a piece of code, in which I am using an
type. I am assigning some values to the enumeration items by using for
statement. I want to refer the assigned vales using the enumeration
That is as shown in the code I wanna refer the values 16#10# using the
item "one", 16#20# using "two" etc. Is there any ways to do this? My aim
to assign some values to the enumeration type and use those values in
place of the enum items just like in C.
procedure Test is
type Enum is
for Enum use
One => 16#10#,
Two => 16#20#,
Three => 16#30#);
Put( Enum'Pos (Three));
Put_Line (Enum'Image (Three));
one = Ox10,
later I can use "one" to refer its value and son on.
Could any body clarify me, if there is any way to do this.
Thanx in advance.