]> git.tdb.fi Git - libs/core.git/blob - source/io/pipe.h
Implement get_handle in File and Pipe
[libs/core.git] / source / io / pipe.h
1 #ifndef MSP_IO_PIPE_H_
2 #define MSP_IO_PIPE_H_
3
4 #include "eventobject.h"
5 #include "eventreader.h"
6 #include "handle.h"
7
8 namespace Msp {
9 namespace IO {
10
11 class Pipe: public EventObject
12 {
13 private:
14         Handle read_handle;
15         Handle write_handle;
16         EventReader reader;
17
18 public:
19         Pipe();
20         ~Pipe();
21
22         void set_block(bool);
23
24 protected:
25         virtual unsigned do_write(const char *, unsigned);
26         virtual unsigned do_read(char *, unsigned);
27
28 public:
29         virtual const Handle &get_handle(Mode);
30         virtual const Handle &get_event_handle() { return reader.get_event(); }
31 };
32
33 } // namespace IO
34 } // namespace Msp
35
36 #endif