From: Maciej Sobczak <no.spam@no.spam.com>
Subject: I/O streaming with custom data transport
Date: Tue, 21 Nov 2006 16:11:02 +0100
Date: 2006-11-21T16:11:02+01:00 [thread overview]
Message-ID: <ejv4u6$qvu$1@cernne03.cern.ch> (raw)
Hi,
In C++ the IOStreams library allows to vary the behaviour of the stream
by decoupling formatting from data buffering and transport to the
physical device, which are in turn strategies for the stream object.
This means that having millions of functions like this:
void foo(ostream &s)
{
s << "Hello";
s << someObject;
s << someOtherObject;
// ...
}
(and *there are* millions of functions like this)
it is possible to reuse these functions with different stream objects,
from standard console output:
foo(cout);
...to file output:
foo(myFile);
...to network socket output:
foo(someSocketStreamConnectedSomewhere);
...to whatever else comes up to the programmer's mind. It's just the
matter of providing the implementation for the stream buffer.
The key point here is that the mass of code out there need not be aware
of it and can be reused with new stream objects without any
modifications (that's OO in action).
I'm looking for something like this in Ada.
The basic I/O facilities in the standard library don't seem to provide
anything like this.
I hoped that Ada.Streams allows this by subclassing Root_Stream_Type and
providing some overriding operations, but unfortunately I cannot even
find the specification of Root_Stream_Type (looks like there isn't any
and this type is just a name placeholder in ARM).
If the standard library does not provide the functionality that I'm
looking for (and I hope that I'm still misunderstanding something here),
did anybody tackle the problem by implementing some replacement IO
library with the functionality similar to that of IOStreams in C++?
--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
next reply other threads:[~2006-11-21 15:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-21 15:11 Maciej Sobczak [this message]
2006-11-21 15:28 ` I/O streaming with custom data transport 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
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