]> git.tdb.fi Git - libs/core.git/blob - source/pipe.h
71edf7eb3246f125ceb09ccd90495381807c8b85
[libs/core.git] / source / pipe.h
1 #ifndef MSP_IO_PIPE_H_
2 #define MSP_IO_PIPE_H_
3
4 #include "base.h"
5
6 namespace Msp {
7 namespace IO {
8
9 class Pipe: public Base
10 {
11 private:
12         Handle handle[2];
13 #ifdef WIN32
14         OVERLAPPED *overlapped;
15         Handle event;
16         unsigned buf_size;
17         char *buffer;
18         unsigned buf_avail;
19         char *buf_next;
20 #endif
21
22 public:
23         Pipe();
24         ~Pipe();
25
26         void close();
27
28         void set_block(bool);
29
30 protected:
31         virtual unsigned do_write(const char *, unsigned);
32         virtual unsigned do_read(char *, unsigned);
33
34 public:
35         virtual Handle get_event_handle();
36 };
37
38 } // namespace IO
39 } // namespace Msp
40
41 #endif