comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Joachim Schr�er" <joachim.schroeer@vs.dasa.de>
Subject: Re: S'Write and How To Count Bytes
Date: 2000/10/02
Date: 2000-10-02T00:00:00+00:00	[thread overview]
Message-ID: <8r9uf5$ocl@newsserv.vs.dasa.de> (raw)
In-Reply-To: hXTB5.64979$Ao1.5807473@newsrump.sjc.telocity.net

I have not thought about the original question but there is
a more elegant solution for your description.

The 'read, 'write attributes are for constrained types.
For unconstrained types (including tagged types/classwide types)
there exist the 'input, 'output attributes. Note, that 'input
is a function. If you want to overwrite 'input, 'output you just
have to overwrite 'read, 'write cause they are used by the former.

For this and input/output of access objects/linked datastructures
you should look into the relevant chapter of Norman Cohens
Ada95 version of "Ada as a second language" or into the Rationale,
chapter A.4.1.

 J. Schroer


David C. Hoos, Sr. <david.c.hoos.sr@ada95.com> schrieb in im Newsbeitrag:
<hXTB5.64979$Ao1.5807473@newsrump.sjc.telocity.net>...
> If your record contains an unbounded string, I would in the
My_Record'Write
> procedure convert the unbounded string to a Standard.String, and write its
> length to the stream with Natural'Write, followed by a call to
String'Write.
> This will put the length of the string on the stream, followed by the
> string itself.
>
> Then, the My_Record'Read procedure would read the length from the stream,
> using Natural'Read, use that length to declare a string of the proper size
> (in a declare block), then read the string with String'Read.
> Finally, you would convert the string to the unbounded string component in
> your My_Record'Read's out parameter of type My_Record.
>
>
> Marin David Condic <mcondic.nospam@acm.org> wrote in message
> news:39D6891A.7DC448B6@acm.org

snip
...









  parent reply	other threads:[~2000-10-02  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-30  0:00 S'Write and How To Count Bytes Marin David Condic
2000-10-01  0:00 ` David C. Hoos, Sr.
2000-10-02  0:00   ` Marin David Condic
2000-10-02  0:00     ` Ted Dennison
2000-10-02  0:00       ` tmoran
2000-10-02  0:00         ` tmoran
2000-10-02  0:00           ` Marin David Condic
2000-10-11  0:00             ` Nick Roberts
2000-10-11  0:00               ` Marin David Condic
2000-10-02  0:00           ` Ted Dennison
2000-10-02  0:00         ` Marin David Condic
2000-10-03  0:00       ` Robert A Duff
2000-10-06  0:00         ` Randy Brukardt
2000-10-07  0:11           ` Ted Dennison
2000-10-06  0:00             ` Randy Brukardt
2000-10-07  0:00             ` Marin David Condic
2000-10-08  0:00               ` Jean-Pierre Rosen
2000-10-09  0:00                 ` Randy Brukardt
2000-10-11  0:00                 ` Marin David Condic
2000-10-02  0:00   ` Dr. Joachim Schr�er [this message]
2000-10-02  0:00     ` Marin David Condic
2000-10-06  0:00       ` Charles Hixson
2000-10-02  0:00 ` David C. Hoos, Sr.
2000-10-02  6:58 ` tmoran
2000-10-02  0:00   ` Marin David Condic
  -- strict thread matches above, loose matches on Subject: below --
2000-10-02  0:00 tmoran
2000-10-03  5:21 ` Marin David Condic
2000-10-03  0:00 Mario Amado Alves
2000-10-03  0:00 ` Marin David Condic
replies disabled

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