comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: Generic Formal Parameter for a Task Type
Date: Mon, 12 Mar 2001 11:14:16 -0500
Date: 2001-03-12T16:14:17+00:00	[thread overview]
Message-ID: <3AACF5D8.6719A9A9@averstar.com> (raw)
In-Reply-To: mailman.984183487.31444.comp.lang.ada@ada.eu.org

"Robert C. Leif, Ph.D." wrote:
> 
> From: Bob Leif
> To: Tucker Taft et al.
> You wrote:
> "If you wanted to avoid generics, you could define an abstract limited
> tagged type (say "Has_Task") which had various (abstract) primitive
> operations, including  at least a "Task_ID" function.  You would then
> extend from this type by adding a component of the task type of interest
> (and of course override the abstract primitives as appropriate)."
> 
> Can you include the "Has_Task" in a generic package; or are the two
> approaches mutually exclusive for tasks?

As I mentioned, you can declare a formal derived type, such as
   generic
       type My_Task is new Has_Task with private;
   ...

and inside the generic use the My_Task type to create tasks and
query the information about instances of the type.

I wrote earlier:
> ...
> Why not have a formal function that returns the Task_ID, rather
> than 'Terminated?  That way, you can use the Ada.Task_Identification
> and Ada.Task_Attributes packages to get whatever else you need from the
> task, including task attributes...
> 
> If you wanted to avoid generics, you could define an abstract limited
> tagged type (say "Has_Task") which had various (abstract) primitive
> operations, including  at least a "Task_ID" function.  You would then
> extend from this type by adding a component of the task type of interest
> (and of course override the abstract primitives as appropriate).
> You could then manipulate objects of type Has_Task'Class, or references
> there-to, in a "Java"-like way ;-).  You could also pass in any
> extension of Has_Task to a generic with a formal tagged derived type
> of "type My_Task is new Has_Task with private;".
> 
> The possibilities are endless...

-- 
-Tucker Taft   stt@avercom.net   http://www.averstar.com/~stt/
Chief Technology Officer, AverCom Corporation (A Titan Company) 
Burlington, MA  USA (AverCom was formerly the Commercial Division of AverStar:
http://www.averstar.com/services/ebusiness_applications.html)



  reply	other threads:[~2001-03-12 16:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-09  4:20 Generic Formal Parameter for a Task Type Beard, Frank
2001-03-09  5:24 ` James Rogers
2001-03-09 21:50   ` Tucker Taft
2001-03-10  0:14     ` Robert C. Leif, Ph.D.
2001-03-12 16:14       ` Tucker Taft [this message]
2001-03-10  3:25     ` James Rogers
2001-03-12 15:33       ` Stephen Leake
2001-03-12 16:11       ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
2001-03-09 22:53 Beard, Frank
2001-03-08 22:38 James Rogers
2001-03-08 23:27 ` Marin David Condic
2001-03-09  0:00 ` Robert A Duff
2001-03-09  0:16 ` Pat Rogers
2001-03-09  3:34   ` James Rogers
2001-03-09  4:26     ` Pat Rogers
2001-03-09  4:58       ` James Rogers
2001-03-09 15:50     ` Stephen Leake
2001-03-10  3:15       ` James Rogers
replies disabled

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