On Thursday 22 August 2002 2:04 pm, Lars Gullik Bj�nnes wrote:
> How do you run select or poll on a filestream?
> Then you must modify the filestream...
> And your really want the handling of this to be part of the main event
> loop.
You see! You've answered my queries. Thank you.
That means that I can't do the "move gradually to Pipestream" as I hoped, but
will have to do it in one go. Fair enough.
There's little point in having either a PipeStream or a SocketStream it we
aren't going to know when they've got something interesting to say.
So, let's rethink.
I envisage a MonitoredStream class
class MonitoredStream {
std::iostream & stream();
boost::signal0<void> input_received;
}
where the std::iostream & stream() returns a pipestream:
pipestream::pipestream(char const * const cmd[])
: std::iostream(pipebuf_create(cmd))
{}
and pipebuf_create created a new pipebuf.
class pipebuf : public streambuf {
public:
/// The only constructor we need
explicit pipebuf(int sock);
/// destructor
~pipebuf();
private:
/// The detais of the class are unclear to me, but it'll have to use
/// open(), close(), read() and write() if we are going to be able to
/// monitor the file device for any changes.
/// our socket.
int const sock_;
};
Does this make more sense to you?
Angus