comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex R. Mosteo" <devnull@mailinator.com>
Subject: Re: I/O streaming with custom data transport
Date: Wed, 22 Nov 2006 11:01:53 +0100
Date: 2006-11-22T11:01:53+01:00	[thread overview]
Message-ID: <4silcoFvv69nU1@mid.individual.net> (raw)
In-Reply-To: ek14i8$k0g$1@cernne03.cern.ch

Maciej Sobczak wrote:

> The point here is that the Write_Hello procedure can be reused with
> various streams, just like my foo functions in C++ (from initial post).
> 
> Is the code above correct? Any traps or problems that I don't see at the
> moment?

That's it. 

About traps, more complex streams may require special care: for example,
imagine your characters are multi-byte and you receive an incomplete
character code in the write function. This could happen if, for example, a
previous buffering stream doesn't respect boundaries of received data. In
those cases, you need to start worrying about what to do, but I'd say this
is pretty much implementation detail not related to the general stream
pattern.

Just a nitpick: in your example, instead of allocating a new stream I would
simply get an access to a stack-allocated one:

declare
   S2 : aliased My_Stream;
begin
� �Write_Hello (S2'Access);
end;



  reply	other threads:[~2006-11-22 10:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-21 15:11 I/O streaming with custom data transport Maciej Sobczak
2006-11-21 15:28 ` gautier_niouzes
2006-11-21 17:51 ` Alex R. Mosteo
2006-11-22  9:16   ` Maciej Sobczak
2006-11-22 10:01     ` Alex R. Mosteo [this message]
2006-11-22 10:39       ` Maciej Sobczak
2006-11-22 16:06         ` Dmitry A. Kazakov
2006-11-22 16:30         ` Alex R. Mosteo
2006-11-23  5:48         ` Simon Wright
2006-11-22 13:50     ` Robert A Duff
2006-11-22 14:37       ` Maciej Sobczak
2006-11-22 16:11         ` Georg Bauhaus
2006-11-21 19:02 ` Dmitry A. Kazakov
2006-11-22  9:21   ` Maciej Sobczak
2006-11-22 10:31     ` Dmitry A. Kazakov
replies disabled

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