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.4 required=5.0 tests=BAYES_00,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,51359402da60c472 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-27 17:54:46 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: DYNAMIC ADA TASK CREATION? Date: 27 Jun 2003 17:54:45 -0700 Organization: http://groups.google.com/ Message-ID: <1ec946d1.0306271654.636c1373@posting.google.com> References: <3EF0026E.2050309@attbi.com> <3EF0F57D.9060507@attbi.com> <3EF15A7C.4030901@attbi.com> NNTP-Posting-Host: 66.162.65.162 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1056761686 5741 127.0.0.1 (28 Jun 2003 00:54:46 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 28 Jun 2003 00:54:46 GMT Xref: archiver1.google.com comp.lang.ada:39857 Date: 2003-06-28T00:54:46+00:00 List-Id: "Robert I. Eachus" 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