]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/memory.h
Implement controls for file descriptor inheritance
[libs/core.git] / source / io / memory.h
index ba6c4d87995306653d0eda5ca245b95566ffb645..4a6eca2ab44178636a0fa3016c97910f8834230f 100644 (file)
@@ -1,13 +1,12 @@
 #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;
@@ -15,13 +14,18 @@ private:
        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:
@@ -29,13 +33,10 @@ 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