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 X-Google-Thread: 103376,b8b2de2a45e33b46 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: Usage of Ada.Streams Date: 2000/01/19 Message-ID: #1/1 X-Deja-AN: 574658403 Content-Transfer-Encoding: 8bit References: <862lc7$s8a$1@inf2.informatik.uni-stuttgart.de> <863vhk$qje$1@wanadoo.fr> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-ELN-Date: Wed Jan 19 04:29:41 2000 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 948284981 158.252.123.234 (Wed, 19 Jan 2000 04:29:41 PST) Organization: EarthLink Network, Inc. MIME-Version: 1.0 NNTP-Posting-Date: Wed, 19 Jan 2000 04:29:41 PST Newsgroups: comp.lang.ada Date: 2000-01-19T00:00:00+00:00 List-Id: Pascal Obry wrote in message news:863vhk$qje$1@wanadoo.fr... > David C. Hoos, Sr. a �crit dans le message ... > >If you want to have the tags in the stream (so that the specific > >types can be distinguished when reading back), you need to use: > >Data'Class'Output(Str, Data_Pointer.all); > > > >Then, to read them back, you would say: > >Data_Pointer := new Data'Class'(Data'Class'Input (str)); > > > >That statement allocates memory for the object, and initializes it > >with the value read from the stream. > > > > That's correct, but note that it is not necessary to use pointer under > Ada95. Agreed. I only used an access type because the original poster was writing from a dereferenced access object. Also, local declare blocks, of course, are more restricted in scope than dynamically-allocated objects. Which to use depends on other considerations, but I would probably use a storage pool if dynamically allocating, especially in a long-running program reading from, say, a network stream.