]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/base.h
Move non-oneliner functions out of RefPtr class declaration
[libs/core.git] / source / io / base.h
index c58be90f7ebd039504e261105e53dc7329a1ac13..b6d1ff65a2a83f1b793d10fb5a4d36fd9f966efa 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <sigc++/sigc++.h>
 #include <msp/core/mutex.h>
+#include <msp/core/noncopyable.h>
 #include "handle.h"
 #include "mode.h"
 #include "poll.h"
@@ -12,11 +13,8 @@ namespace IO {
 
 /**
 Common interface for all I/O objects.
-
-A derived class must call set_events(P_NONE) before it is destroyed to avoid
-leaving stale pointers in an EventDispatcher.
 */
-class Base
+class Base: private NonCopyable
 {
 public:
        /** RAII synchronization primitive.  Prevents concurrent access to the
@@ -48,9 +46,6 @@ protected:
        Mutex *mutex;
 
        Base();
-private:
-       Base(const Base &);
-       Base &operator=(const Base &);
 public:
        virtual ~Base();
 
@@ -60,7 +55,13 @@ public:
        was done.
 
        Blocking is enabled by default. */
-       virtual void set_block(bool) { }
+       virtual void set_block(bool) = 0;
+
+       /** Sets inheritance mode.  When inheritance is enabled, the file descriptor
+       will persist through Process::execute.
+
+       Inheritance is disabled by default. */
+       virtual void set_inherit(bool) = 0;
 
        /** Returns the current mode flags. */
        Mode get_mode() const { return mode; }
@@ -108,7 +109,7 @@ public:
 
        /** Returns the system-level handle for the object.  Used by Console to
        perform redirections. */
-       virtual const Handle &get_handle(Mode);
+       virtual const Handle &get_handle(Mode) = 0;
 };
 
 } // namespace IO