]> git.tdb.fi Git - libs/core.git/blob - source/io/handle.h
Use vectors for storage in Poller
[libs/core.git] / source / io / handle.h
1 #ifndef MSP_IO_HANDLE_H_
2 #define MSP_IO_HANDLE_H_
3
4 namespace Msp {
5 namespace IO {
6
7 class Handle
8 {
9 public:
10         struct Private;
11
12 private:
13         Private *priv;
14
15 public:
16         Handle();
17         Handle(const Handle &);
18         Handle &operator=(const Handle &);
19         ~Handle();
20
21         Private &operator*() { return *priv; }
22         const Private &operator*() const { return *priv; }
23
24         /** This is effectively a boolean conversion, but avoids accidental
25         conversion to OS native handles.  Unix-based systems use int and win32 uses
26         void *; const void * is not implicitly convertible to either. */
27         operator const void *() const;
28 };
29
30
31 void sys_set_blocking(Handle &, bool);
32 void sys_set_inherit(Handle &, bool);
33 unsigned sys_read(Handle &, char *, unsigned);
34 unsigned sys_write(Handle &, const char *, unsigned);
35 void sys_close(Handle &);
36
37 } // namespace IO
38 } // namespace Msp
39
40 #endif