Topic: I/O streams


Author: mikes@abc.se (Mikael St\eldal)
Date: 1996/08/02
Raw View
I think that there should be two classes derived from streambuf/ios,
one for sequencial streams and one for random access streams.

Proprites for random access streams:
* Often used only for input or only output, but can also be used for
both at the same time
* Streampos can be used.
* All data to be read are there when you open the stream (unless you
write while reading) and there are a distinct EOF when reading
sequnencial. There are no such things as timeout.

Propriets for sequencial streams:
*Often (always?) used for both input and output at the same time, only
input/only output need not to be supported.
*Streampos can not be used.
*There are no distinct EOF, but there can be connected state. There
may be timeouts which must be distingoutable from EOF/disconnect.
*Read and write timeout values should be settable.
*Read and write buffers should be individully settable (you may want
buffered output and unbuffered input).
*There should be standardized methods for things like disconnection
and check if connected.

Both fstream and strstream are random access streams. Sequencial
streams could be streams for data communication such as asynchronous
serial port and network sockets.

I have made streams for asynchronouy serial port and networks sockets,
that was not so easy as it could have been since the streambuf
interface is optimized for random access streams.
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]





Author: mikes@abc.se \e \e (Mikael St\eldal)
Date: 1996/07/24
Raw View
I think that there should be two classes derived from streambuf/ios,
one for sequencial streams and one for random access streams.

Proprites for random access streams:
* Often used only for input or only output, but can also be used for
both at the same time
* Streampos can be used.
* All data to be read are there when you open the stream (unless you
write while reading) and there are a distinct EOF when reading
sequnencial. There are no such things as timeout.

Propriets for sequencial streams:
*Often (always?) used for both input and output at the same time, only
input/only output need not to be supported.
*Streampos can not be used.
*There are no distinct EOF, but there can be connected state. There
may be timeouts which must be distingoutable from EOF/disconnect.
*Read and write timeout values should be settable.
*Read and write buffers should be individully settable (you may want
buffered output and unbuffered input).
*There should be standardized methods for things like disconnection
and check if connected.

Both fstream and strstream are random access streams. Sequencial
streams could be streams for data communication such as asynchronous
serial port and network sockets.

I have made streams for asynchronouy serial port and networks sockets,
that was not so easy as it could have been since the streambuf
interface is optimized for random access streams.
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]