comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@on2.com (Matthew Heaney)
Subject: Re: DYNAMIC ADA TASK CREATION?
Date: 27 Jun 2003 17:54:45 -0700
Date: 2003-06-28T00:54:46+00:00	[thread overview]
Message-ID: <1ec946d1.0306271654.636c1373@posting.google.com> (raw)
In-Reply-To: 3EF15A7C.4030901@attbi.com

"Robert I. Eachus" <rieachus@attbi.com> wrote in message news:<3EF15A7C.4030901@attbi.com>...

>   There are times when a programmer will create an object type that 
> contains tasks.  And he may want to use, say, a container package for 
> objects of this type. (Yes, most container libraries refuse to work with 
> limited data objects, but not all.)

The new release of the Charles library does indeed work with element
types that are limited.  The basic idea is that when you insert an
element into the container, the element is allocated with its default
value -- whatever that means for the element type.  For example, for
an element type that is controlled, controlled initialization will
occur.

The list works like this:

procedure Op (List : in out List_Subtype) is
begin
   Push_Back (List);

   declare
      I : constant Iterator_Type := Last (List);
      E : Limited_Element_Type renames To_Access (I).all;
   begin
      --now manipulate E as desired
   end;
end Op;

A map works like this:

procedure Op (Map : in out Map_Subtype) is
   I : Iterator_Type;
begin
   Insert (Map, Key, I);

   declare
      E : Limited_Element_Type renames To_Access (I).all;
   begin
      --now manipulate E as desired
   end;
end Op;

For example, this schema allows you to create a map of File_Type,
indexed by its file name (of type String).  For example:

procedure Insert
  (Map  : in out Map_Subtype;
   Name : in     String) is

   I : Iterator_Type;
begin
   Insert (Map, Key => Name, Iterator => I);

   declare
      File : File_Type renames To_Access (I).all;
   begin
      Open (File, Mode => Out_File, Name => Name);
      --...
   end;
end Insert;


Not all of the containers for limited elements are there yet -- I
still have to do the multisets and multimaps.  I'll post them next
week (30 June 2003).

http://home.earthlink.net/~matthewjheaney/charles/index.html

http://home.earthlink.net/~matthewjheaney/charles/charles-20030627.zip

I also posted the slides from my paper presentation about Charles at
the Ada-Europe 2003 conference which took place last week in Toulouse,
France.

http://home.earthlink.net/~matthewjheaney/charles/charles.ppt

http://home.earthlink.net/~matthewjheaney/charles/charlesppt.pdf

http://home.earthlink.net/~matthewjheaney/charles/charlesppt.htm



  parent reply	other threads:[~2003-06-28  0:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-17 19:53 DYNAMIC ADA TASK CREATION? avram
2003-06-17 20:24 ` Simon Wright
2003-06-18  6:11   ` Robert I. Eachus
2003-06-18  9:20     ` Georg Bauhaus
2003-06-18 11:13       ` John McCabe
2003-06-18 12:43         ` John McCabe
2003-06-18 14:17           ` Georg Bauhaus
2003-06-19  5:07         ` Simon Wright
2003-06-19  6:05           ` Robert I. Eachus
2003-06-19 23:30             ` Jeffrey Carter
2003-06-18 19:15     ` avram
2003-06-18 21:17       ` Craig Carey
2003-06-20 18:56         ` avram
2003-06-21 13:06           ` Pascal Obry
2003-06-18 23:28       ` Robert I. Eachus
2003-06-19  5:09         ` Simon Wright
2003-06-19  6:39           ` Robert I. Eachus
2003-06-19 20:34             ` Simon Wright
2003-06-28  0:54             ` Matthew Heaney [this message]
2003-06-28  7:25               ` Robert I. Eachus
2003-06-30  7:35                 ` Dmitry A. Kazakov
2003-06-30 15:01                   ` Matthew Heaney
2003-07-01  7:19                     ` Dmitry A. Kazakov
2003-07-01 14:21                       ` Matthew Heaney
2003-07-02 12:05                     ` Mário Amado Alves
2003-07-02 19:41                       ` Simon Wright
2003-07-03 21:31                         ` Mário Amado Alves
2003-07-03  9:53                   ` Robert I. Eachus
replies disabled

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