1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::Pipe</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class Pipe</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Processes<br />
<b>Header:</b> Poco/Pipe.h</p>
<h2>Description</h2>
<div class="description">
<p>This class implements an anonymous pipe. </p>
<p>Pipes are a common method of inter-process communication - on Unix, pipes are the oldest form of IPC. </p>
<p>A pipe is a half-duplex communication channel, which means that data only flows in one direction. Pipes have a read-end and a write-end. One process writes to the pipe and another process reads the data written by its peer. Read and write operations are always synchronous. A read will block until data is available and a write will block until the reader reads the data. </p>
<p>The sendBytes() and <a href="Poco.Pipe.html#9360" title="Poco::Pipe::readBytes()">readBytes</a>() methods of <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> are usually used through a <a href="Poco.PipeOutputStream.html" title="class Poco::PipeOutputStream">PipeOutputStream</a> or <a href="Poco.PipeInputStream.html" title="class Poco::PipeInputStream">PipeInputStream</a> and are not called directly. </p>
<p><a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> objects have value semantics; the actual work is delegated to a reference-counted PipeImpl object. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.Pipe.html#9365" title="Poco::Pipe::close()">close</a>, <a href="Poco.Pipe.html#9355" title="Poco::Pipe::operator =()">operator =</a>, <a href="Poco.Pipe.html#9360" title="Poco::Pipe::readBytes()">readBytes</a>, <a href="Poco.Pipe.html#9363" title="Poco::Pipe::readHandle()">readHandle</a>, <a href="Poco.Pipe.html#9357" title="Poco::Pipe::writeBytes()">writeBytes</a>, <a href="Poco.Pipe.html#9364" title="Poco::Pipe::writeHandle()">writeHandle</a></p>
<h2>Types</h2>
<h3><a name="9346">Handle</a></h3>
<p class="decl">typedef PipeImpl::<a href="Poco.Pipe.html#9346" title="Poco::Pipe::Handle">Handle</a> <a href="Poco.Pipe.html#9346" title="Poco::Pipe::Handle">Handle</a>;</p>
<div class="description">
<p>The read/write handle or file descriptor. </p>
</div>
<h2>Enumerations</h2>
<h3><a name="9347">CloseMode</a></h3>
<div class="description">
<p>used by <a href="Poco.Pipe.html#9365" title="Poco::Pipe::close()">close</a>() </p>
</div>
<p class="decl"><a name="9348">CLOSE_READ</a> = 0x01</p>
<div class="description">
<p>Close reading end of pipe. </p>
</div>
<p class="decl"><a name="9349">CLOSE_WRITE</a> = 0x02</p>
<div class="description">
<p>Close writing end of pipe. </p>
</div>
<p class="decl"><a name="9350">CLOSE_BOTH</a> = 0x03</p>
<div class="description">
<p>Close both ends of pipe. </p>
</div>
<h2>Constructors</h2>
<h3><a name="9351">Pipe</a></h3>
<p class="decl"><a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>();</p>
<div class="description">
<p>Creates the <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>. </p>
<p>Throws a <a href="Poco.CreateFileException.html" title="class Poco::CreateFileException">CreateFileException</a> if the pipe cannot be created. </p>
</div>
<h3><a name="9352">Pipe</a></h3>
<p class="decl"><a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>(<br /> const <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> & pipe<br />);</p>
<div class="description">
<p>Creates the <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> using the PipeImpl from another one. </p>
</div>
<h2>Destructor</h2>
<h3><a name="9354">~Pipe</a></h3>
<p class="decl">~<a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>();</p>
<div class="description">
<p>Closes and destroys the <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="9365">close</a></h3>
<p class="decl">void close(<br /> <a href="Poco.Pipe.html#9347" title="enum Poco::Pipe::CloseMode">CloseMode</a> mode = CLOSE_BOTH<br />);</p>
<div class="description">
<p>Depending on the argument, closes either the reading end, the writing end, or both ends of the <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>. </p>
</div>
<h3><a name="9355">operator =</a></h3>
<p class="decl"><a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> & operator = (<br /> const <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a> & pipe<br />);</p>
<div class="description">
<p>Releases the <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>'s PipeImpl and assigns another one. </p>
</div>
<h3><a name="9360">readBytes</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int readBytes(<br /> void * buffer,<br /> int length<br />);</p>
<div class="description">
<p>Receives data from the pipe and stores it in buffer. Up to length bytes are received. Blocks until data becomes available. </p>
<p>Returns the number of bytes received, or 0 if the pipe has been closed. </p>
<p>Throws a <a href="Poco.ReadFileException.html" title="class Poco::ReadFileException">ReadFileException</a> if nothing can be read. </p>
</div>
<h3><a name="9363">readHandle</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.Pipe.html#9346" title="Poco::Pipe::Handle">Handle</a> readHandle() const;</p>
<div class="description">
<p>Returns the read handle or file descriptor for the <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>. For internal use only. </p>
</div>
<h3><a name="9357">writeBytes</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">int writeBytes(<br /> const void * buffer,<br /> int length<br />);</p>
<div class="description">
<p>Sends the contents of the given buffer through the pipe. Blocks until the receiver is ready to read the data. </p>
<p>Returns the number of bytes sent. </p>
<p>Throws a <a href="Poco.WriteFileException.html" title="class Poco::WriteFileException">WriteFileException</a> if the data cannot be written. </p>
</div>
<h3><a name="9364">writeHandle</a> <img src="images/inline.gif" alt="inline" title="inline" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl"><a href="Poco.Pipe.html#9346" title="Poco::Pipe::Handle">Handle</a> writeHandle() const;</p>
<div class="description">
<p>Returns the write handle or file descriptor for the <a href="Poco.Pipe.html" title="class Poco::Pipe">Pipe</a>. For internal use only. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>
</div>
</body>
</html>
|