|
|
@ -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__ |
|
|
|
#ifndef __MRW_UNISTD_HPP__ |
|
|
|
#define __MRW_UNISTD_HPP__ |
|
|
|
#define __MRW_UNISTD_HPP__ |
|
|
|
|
|
|
|
|
|
|
@ -13,14 +25,14 @@ namespace mrw { |
|
|
|
|
|
|
|
|
|
|
|
Implements a UNIX pipe that is automatically closed in |
|
|
|
Implements a UNIX pipe that is automatically closed in |
|
|
|
destructor and offers some facilities. */ |
|
|
|
destructor and offers some facilities. */ |
|
|
|
class pipe { |
|
|
|
class Pipe { |
|
|
|
private: |
|
|
|
private: |
|
|
|
/// the filedescriptor, [0] to read and [1] to write
|
|
|
|
/// the filedescriptor, [0] to read and [1] to write
|
|
|
|
int _fd[2]; |
|
|
|
int _fd[2]; |
|
|
|
int _lastError; |
|
|
|
int _lastError; |
|
|
|
public: |
|
|
|
public: |
|
|
|
/// creates a unix pipe
|
|
|
|
/// creates a unix pipe
|
|
|
|
pipe(): _lastError(-1) { |
|
|
|
Pipe(): _lastError(-1) { |
|
|
|
_fd[0] = -1; |
|
|
|
_fd[0] = -1; |
|
|
|
_fd[1] = -1; |
|
|
|
_fd[1] = -1; |
|
|
|
if (::pipe(_fd)==-1) |
|
|
|
if (::pipe(_fd)==-1) |
|
|
@ -29,7 +41,7 @@ namespace mrw { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/// destructor closes pipe if still open
|
|
|
|
/// destructor closes pipe if still open
|
|
|
|
~pipe() { |
|
|
|
~Pipe() { |
|
|
|
close(); |
|
|
|
close(); |
|
|
|
} |
|
|
|
} |
|
|
|
/// closes pipe if open
|
|
|
|
/// closes pipe if open
|
|
|
|