home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / k3bpipe.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-27  |  1.2 KB  |  61 lines

  1. /* 
  2.  *
  3.  * $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $
  4.  * Copyright (C) 2006 Sebastian Trueg <trueg@k3b.org>
  5.  *
  6.  * This file is part of the K3b project.
  7.  * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  * See the file "COPYING" for the exact licensing terms.
  14.  */
  15.  
  16. #ifndef _K3B_PIPE_H_
  17. #define _K3B_PIPE_H_
  18.  
  19. #include "k3b_export.h"
  20.  
  21. /**
  22.  * The K3bPipe class represents a file descriptor pair
  23.  * which can for example be used to connect two processes
  24.  */
  25. class LIBK3B_EXPORT K3bPipe
  26. {
  27.  public:
  28.   /**
  29.    * Creates a closed pipe object
  30.    */
  31.   K3bPipe();
  32.  
  33.   /**
  34.    * The destructor takes care of closing the pipe
  35.    */
  36.   ~K3bPipe();
  37.  
  38.   /**
  39.    * Open the pipe. This creates a file descriptor pair
  40.    * which can be accessed using the in() and out()
  41.    * methods.
  42.    */
  43.   bool open();
  44.  
  45.   /**
  46.    * Calls both closeIn() and closeOut()
  47.    */
  48.   void close();
  49.  
  50.   void closeIn();
  51.   void closeOut();
  52.  
  53.   int in() const { return m_fd[1]; }
  54.   int out() const { return m_fd[0]; }
  55.  
  56.  private:
  57.   int m_fd[2];
  58. };
  59.  
  60. #endif
  61.