comp.lang.ada
 help / color / mirror / Atom feed
* Record size
@ 2005-03-23 14:11 Bj?rn
  2005-03-23 15:38 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: Bj?rn @ 2005-03-23 14:11 UTC (permalink / raw)


How can I check the size of a record, including one/several array
components, without having the array bounds included in the result?

I want to save the record size before writing it on a socket with
�Write. It would be very convenient if I could do this without having
to manually subtract the bounds size / counting record component
sizes.

Is this possible in Ada? If not, might there be some GNAT specific
attribute that might do the trick?

Thanks,
Bj�rn



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Record size
  2005-03-23 14:11 Record size Bj?rn
@ 2005-03-23 15:38 ` Dmitry A. Kazakov
  2005-03-23 19:00   ` tmoran
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry A. Kazakov @ 2005-03-23 15:38 UTC (permalink / raw)


On 23 Mar 2005 06:11:39 -0800, Bj?rn wrote:

> How can I check the size of a record, including one/several array
> components, without having the array bounds included in the result?
> 
> I want to save the record size before writing it on a socket with
> �Write. It would be very convenient if I could do this without having
> to manually subtract the bounds size / counting record component
> sizes.

This wouldn't be portable. And if portability is not required then you can
enjoy Ada.Streams which take that burden from you (provided that you won't
use UDP.) Make your implementation of stream's Write writing into the
socket.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Record size
  2005-03-23 15:38 ` Dmitry A. Kazakov
@ 2005-03-23 19:00   ` tmoran
  2005-03-24 17:06     ` Bj?rn
  0 siblings, 1 reply; 4+ messages in thread
From: tmoran @ 2005-03-23 19:00 UTC (permalink / raw)


> > How can I check the size of a record, including one/several array
> > components, without having the array bounds included in the result?
> ...
> Make your implementation of stream's Write writing into the socket.
   If the object is to send the size, followed by the data of that size,
then he can make two different "new Root_Stream_Type".  The
Write(Stream, Item) for one simply adds up the sizes of the Item array,
while the other Write actually outputs the Item array.
   Note that if the size of array bounds is to be excluded, then he
needs to use 'Write, not 'Output, for the size counting.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Record size
  2005-03-23 19:00   ` tmoran
@ 2005-03-24 17:06     ` Bj?rn
  0 siblings, 0 replies; 4+ messages in thread
From: Bj?rn @ 2005-03-24 17:06 UTC (permalink / raw)


>    If the object is to send the size, followed by the data of that size,
> then he can make two different "new Root_Stream_Type".  The
> Write(Stream, Item) for one simply adds up the sizes of the Item array,
> while the other Write actually outputs the Item array.

This looks like the solution that I was searching for. Thanks!
Bj�rn



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-24 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-23 14:11 Record size Bj?rn
2005-03-23 15:38 ` Dmitry A. Kazakov
2005-03-23 19:00   ` tmoran
2005-03-24 17:06     ` Bj?rn

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