|
|
|
@ -1,3 +1,15 @@ |
|
|
|
|
/** @file
|
|
|
|
|
|
|
|
|
|
$Log$ |
|
|
|
|
Revision 1.3 2004/08/25 08:22:19 marc |
|
|
|
|
added file header |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@copy © Copyright 2004, $Date$ $Author$ |
|
|
|
|
@author $Author$ |
|
|
|
|
@date $Date$ |
|
|
|
|
@version $Header$ |
|
|
|
|
*/ |
|
|
|
|
#ifndef __MRW_UNISTD_HPP__ |
|
|
|
|
#define __MRW_UNISTD_HPP__ |
|
|
|
|
|
|
|
|
@ -13,14 +25,14 @@ namespace mrw { |
|
|
|
|
|
|
|
|
|
Implements a UNIX pipe that is automatically closed in |
|
|
|
|
destructor and offers some facilities. */ |
|
|
|
|
class pipe { |
|
|
|
|
class Pipe { |
|
|
|
|
private: |
|
|
|
|
/// the filedescriptor, [0] to read and [1] to write
|
|
|
|
|
int _fd[2]; |
|
|
|
|
int _lastError; |
|
|
|
|
public: |
|
|
|
|
/// creates a unix pipe
|
|
|
|
|
pipe(): _lastError(-1) { |
|
|
|
|
Pipe(): _lastError(-1) { |
|
|
|
|
_fd[0] = -1; |
|
|
|
|
_fd[1] = -1; |
|
|
|
|
if (::pipe(_fd)==-1) |
|
|
|
@ -29,7 +41,7 @@ namespace mrw { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/// destructor closes pipe if still open
|
|
|
|
|
~pipe() { |
|
|
|
|
~Pipe() { |
|
|
|
|
close(); |
|
|
|
|
} |
|
|
|
|
/// closes pipe if open
|
|
|
|
|