comp.lang.ada
 help / color / mirror / Atom feed
From: "W. Wesley Groleau (Wes)" <see.signature@this.message>
Subject: Re: Task Discriminants & Arrays
Date: 1997/05/14
Date: 1997-05-14T00:00:00+00:00	[thread overview]
Message-ID: <3379C86F.352@this.message> (raw)
In-Reply-To: EA4L3s.B26@world.std.com


Robert A Duff wrote:
> In article <mheaney-ya023680001305970024550001@news.ni.net>,
> Matthew Heaney <mheaney@ni.net> wrote:
> >It would be really swell if I could give the task object component of the
> >array an identifier that is its index position in the array.  Anyone got
> >any ideas about how to do this?
> 
> You can give the discriminant a default, which is a function that
> increments a counter and returns the new value.  (Horrors!  A function
> with a side-effect! ;-))  This will not guarantee that A(I).Id = I,
> since the array components are initialized in an arbitrary order.  But
> it does guarantee that each task will get a unique Id, which might be
> what you want.  

Is it not true that I can read the ID of each task?  

function "<" ( Left, Right : Discriminated_Task ) return Boolean is
begin
  return Left.ID < Right.ID;
end "<"

-- write Bob Duff's ID function to ensure that all IDs are in A'Range 
-- instantiate your favorite sort with the "<" above and Matt's array.
-- declare the array, then sort it.
-- result:  A(I).ID = I  for all  I in A'Range

----------------------------------------------------------------------
    Wes Groleau, Hughes Defense Communications, Fort Wayne, IN USA
Senior Software Engineer - AFATDS                  Tool-smith Wanna-be

  w w g r o l  at  p s e u l t 0 1  dot  f w  dot  h a c  dot  c o m

     SPAM should be sent to   I.want.one@mailbombs.for.idiots.org
 If you don't want to pay $500 (see 47 USC 227), don't send it here.
----------------------------------------------------------------------




  reply	other threads:[~1997-05-14  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-13  0:00 Task Discriminants & Arrays Matthew Heaney
1997-05-13  0:00 ` Jeff Carter
1997-05-13  0:00   ` John G. Volan
1997-05-14  0:00     ` Jeff Carter
1997-05-13  0:00   ` Matthew Heaney
1997-05-13  0:00 ` Robert A Duff
1997-05-14  0:00   ` W. Wesley Groleau (Wes) [this message]
1997-05-15  0:00     ` Robert A Duff
1997-05-15  0:00       ` John G. Volan
1997-05-15  0:00         ` Matthew Heaney
1997-05-15  0:00           ` John G. Volan
1997-05-15  0:00         ` Robert A Duff
1997-05-16  0:00           ` John G. Volan
1997-05-16  0:00             ` John G. Volan
1997-05-15  0:00     ` Mats Weber
replies disabled

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