comp.lang.ada
 help / color / mirror / Atom feed
From: "Pascal Obry" <p.obry@wanadoo.fr>
Subject: Re: Usage of Ada.Streams
Date: 2000/01/19
Date: 2000-01-19T09:18:44+00:00	[thread overview]
Message-ID: <863vhk$qje$1@wanadoo.fr> (raw)
In-Reply-To: H89h4.6268$Wn2.140519@newsread2.prod.itd.earthlink.net

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

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.

Data'Class'Output (Str, Object);

(with Object whatever instance in the class heriachy).

New_Object : constant Data'Class := Data'Class'Input (Str);

Pascal.

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://ourworld.compuserve.com/homepages/pascal_obry
--|
--| "The best way to travel is by means of imagination"







  reply	other threads:[~2000-01-19  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-18  0:00 Usage of Ada.Streams Joerg Ruedenauer
2000-01-19  0:00 ` David C. Hoos, Sr.
2000-01-19  0:00   ` Pascal Obry [this message]
2000-01-19  0:00     ` David C. Hoos, Sr.
2000-01-19  0:00       ` Pascal Obry
replies disabled

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