libmoost
/home/mhx/git/github/libmoost/include/moost/service/detail/posix_stream_stealer.h
Go to the documentation of this file.
00001 /* vim:set ts=3 sw=3 sts=3 et: */
00028 #ifndef FM_LAST_MOOST_SERVICE_DETAIL_POSIX_STREAM_STEALER
00029 #define FM_LAST_MOOST_SERVICE_DETAIL_POSIX_STREAM_STEALER
00030 
00031 namespace moost { namespace service { namespace detail {
00032 
00033 class posix_stream_stealer
00034 {
00035 public:
00036    posix_stream_stealer(bool restore, bool close_pipe);
00037    ~posix_stream_stealer();
00038    bool steal(FILE *);
00039    bool restore(bool);
00040 
00041    int get_pipe_fd() const
00042    {
00043       return m_pipe_fd;
00044    }
00045 
00046    int get_backup_fd() const
00047    {
00048       return m_backup_fd;
00049    }
00050 
00051 private:
00052    FILE *m_handle;
00053    int m_pipe_fd;
00054    int m_backup_fd;
00055    bool m_restore;
00056    bool m_close_pipe;
00057 };
00058 
00059 } } }
00060 
00061 #endif