#ifndef MSP_IO_PIPE_H_
#define MSP_IO_PIPE_H_
-#include "base.h"
+#include "eventobject.h"
+#include "eventreader.h"
#include "handle.h"
namespace Msp {
namespace IO {
-class Pipe: public Base
+class Pipe: public EventObject
{
private:
- struct Private;
-
- Handle handle[2];
- Private *priv;
+ Handle read_handle;
+ Handle write_handle;
+ EventReader reader;
public:
Pipe();
+private:
+ void platform_init();
+public:
~Pipe();
- void close();
-
- void set_block(bool);
+ void set_mode(Mode);
+ virtual void set_block(bool);
+ virtual void set_inherit(bool);
protected:
- virtual unsigned do_write(const char *, unsigned);
- virtual unsigned do_read(char *, unsigned);
+ virtual std::size_t do_write(const char *, std::size_t);
+ virtual std::size_t do_read(char *, std::size_t);
public:
- virtual const Handle &get_event_handle();
+ virtual const Handle &get_handle(Mode);
+ virtual const Handle &get_event_handle() { return reader.get_event(); }
};
} // namespace IO