Question about the STREAM class hierarchy

2 messages Options
Embed this post
Permalink
Daniel F Moisset-3

Question about the STREAM class hierarchy

Reply Threaded More More options
Print post
Permalink
Hi,
   I am writing a couple of classes that behave essentially as
character streams, so I chose to inherit from INPUT_STREAM (because it
will be useful to use these classes later in contexts where files are
accepted). Then I noted that there were a TERMINAL_INPUT_STREAM which
did some useful constant definitions... but besides that I find hard
to know what is exactly the concept of a "terminal stream"

So, any good examples of which things should be terminal streams and
which ones shouldn't?

Thanks,
    D.
Cyril ADRIAN

Re: Question about the STREAM class hierarchy

Reply Threaded More More options
Print post
Permalink
Hi Daniel,

On Thu, Mar 19, 2009 at 3:54 PM, Daniel Moisset <[hidden email]> wrote:
So, any good examples of which things should be terminal streams and
which ones shouldn't?

"Terminal streams" are streams that get or put characters from/to "something physical", usually external to the system (a file, a tty, a socket... - see the "terminal" cluster). There are also some exotic cases: null streams, STRING-connected streams...

They are opposed to "filter streams" that build upon a stream to transform it in some ways (think compression, base64, parsing and so on - see the "filters" cluster). You may nest filters ad nauseam.

Imagine the structure as a pipe: client <-> filter <-...-> filter <-> terminal

To summarize:
- INPUT_STREAM is the parent of both TERMINAL_INPUT_STREAM and FILTER_INPUT_STREAM
- ditto for OUTPUT_*
- STREAM is the parent of both INPUT_STREAM and OUTPUT_STREAM and the conformant top of the hierarchy

Hope it helps,

Best regards,
--
Cyril ADRIAN

http://www.cadrian.net/~cyril