From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b4731a3b5d591abd X-Google-Attributes: gid103376,public From: "W. Wesley Groleau (Wes)" Subject: Re: Task Discriminants & Arrays Date: 1997/05/14 Message-ID: <3379C86F.352@this.message>#1/1 X-Deja-AN: 241586226 Sender: usenet@most.fw.hac.com (News Administration) X-Nntp-Posting-Host: sparc02 References: Organization: Hughes Defense Communications Newsgroups: comp.lang.ada Date: 1997-05-14T00:00:00+00:00 List-Id: Robert A Duff wrote: > In article , > Matthew Heaney 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. ----------------------------------------------------------------------