#ifndef MSP_IO_MEMORY_H_
#define MSP_IO_MEMORY_H_
-#include "base.h"
-#include "seek.h"
+#include "seekable.h"
namespace Msp {
namespace IO {
-class Memory: public Base
+class Memory: public Seekable
{
private:
char *begin;
char *pos;
public:
- Memory(char *, unsigned);
- Memory(char *, char *);
+ Memory(char *, unsigned, Mode = M_RDWR);
+ Memory(char *, char *, Mode = M_RDWR);
Memory(const char *, unsigned);
Memory(const char *, const char *);
private:
void init(char *, char *, Mode);
+public:
+ virtual void set_block(bool);
+ virtual void set_inherit(bool);
+
+private:
virtual unsigned do_write(const char *, unsigned);
virtual unsigned do_read(char *, unsigned);
public:
virtual bool getline(std::string &);
virtual int get();
- unsigned seek(int, SeekType);
- unsigned tell() const { return pos-begin; }
+ virtual const Handle &get_handle(Mode);
- virtual Handle get_event_handle();
-
-private:
- void check_mode(Mode) const;
+ virtual SeekOffset seek(SeekOffset, SeekType);
+ virtual SeekOffset tell() const { return pos-begin; }
};
} // namespace IO