⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classppipechannel.html

📁 pwlib开发文档
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>PPipeChannel class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>PPipeChannel Class Reference</h1><code>#include &lt;<a class="el" href="pipechan_8h-source.html">pipechan.h</a>&gt;</code><p><p>Inheritance diagram for PPipeChannel:<p><center><img src="classPPipeChannel.png" usemap="#PPipeChannel_map" border="0" alt=""></center><map name="PPipeChannel_map"><area href="classPChannel.html" alt="PChannel" shape="rect" coords="0,56,92,80"><area href="classPObject.html" alt="PObject" shape="rect" coords="0,0,92,24"></map><a href="classPPipeChannel-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Construction</h2></td></tr><tr><td nowrap align=right valign=top>enum &nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a> { <a class="el" href="classPPipeChannel.html#z213_0s0">ReadOnly</a>, <a class="el" href="classPPipeChannel.html#z213_0s1">WriteOnly</a>, <a class="el" href="classPPipeChannel.html#z213_0s2">ReadWrite</a>, <a class="el" href="classPPipeChannel.html#z213_0s3">ReadWriteStd</a> }</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Channel mode for the pipe to the sub-process.</em> <a href="#z213_0">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z213_1">PPipeChannel</a> ()</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z213_2">PPipeChannel</a> (const <a class="el" href="classPString.html">PString</a> &amp;subProgram, <a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a> mode=ReadWrite, BOOL searchPath=TRUE, BOOL stderrSeparate=FALSE)</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z213_3">PPipeChannel</a> (const <a class="el" href="classPString.html">PString</a> &amp;subProgram, const <a class="el" href="classPStringArray.html">PStringArray</a> &amp;argumentList, <a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a> mode=ReadWrite, BOOL searchPath=TRUE, BOOL stderrSeparate=FALSE)</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z213_4">PPipeChannel</a> (const <a class="el" href="classPString.html">PString</a> &amp;subProgram, const <a class="el" href="classPStringToString.html">PStringToString</a> &amp;environment, <a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a> mode=ReadWrite, BOOL searchPath=TRUE, BOOL stderrSeparate=FALSE)</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z213_5">PPipeChannel</a> (const <a class="el" href="classPString.html">PString</a> &amp;subProgram, const <a class="el" href="classPStringArray.html">PStringArray</a> &amp;argumentList, const <a class="el" href="classPStringToString.html">PStringToString</a> &amp;environment, <a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a> mode=ReadWrite, BOOL searchPath=TRUE, BOOL stderrSeparate=FALSE)</td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z213_6">~PPipeChannel</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Close the pipe channel, killing the sub-process.</em> <a href="#z213_6"></a><em></em></font><br><br></td></tr><tr><td colspan=2><br><h2>New member functions</h2></td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_0">Open</a> (const <a class="el" href="classPString.html">PString</a> &amp;subProgram, <a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a> mode=ReadWrite, BOOL searchPath=TRUE, BOOL stderrSeparate=FALSE)</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_1">Open</a> (const <a class="el" href="classPString.html">PString</a> &amp;subProgram, const <a class="el" href="classPStringArray.html">PStringArray</a> &amp;argumentList, <a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a> mode=ReadWrite, BOOL searchPath=TRUE, BOOL stderrSeparate=FALSE)</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_2">Open</a> (const <a class="el" href="classPString.html">PString</a> &amp;subProgram, const <a class="el" href="classPStringToString.html">PStringToString</a> &amp;environment, <a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a> mode=ReadWrite, BOOL searchPath=TRUE, BOOL stderrSeparate=FALSE)</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_3">Open</a> (const <a class="el" href="classPString.html">PString</a> &amp;subProgram, const <a class="el" href="classPStringArray.html">PStringArray</a> &amp;argumentList, const <a class="el" href="classPStringToString.html">PStringToString</a> &amp;environment, <a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a> mode=ReadWrite, BOOL searchPath=TRUE, BOOL stderrSeparate=FALSE)</td></tr><tr><td nowrap align=right valign=top>const <a class="el" href="classPFilePath.html">PFilePath</a> &amp;&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_4">GetSubProgram</a> () const</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_5">Execute</a> ()</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_6">IsRunning</a> () const</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_7">GetReturnCode</a> () const</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_8">WaitForTermination</a> ()</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_9">WaitForTermination</a> (const <a class="el" href="classPTimeInterval.html">PTimeInterval</a> &amp;timeout)</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_10">Kill</a> (int signal=9)</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_11">ReadStandardError</a> (<a class="el" href="classPString.html">PString</a> &amp;errors, BOOL wait=FALSE)</td></tr><tr><td nowrap align=right valign=top>BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z219_12">CanReadAndWrite</a> ()</td></tr><tr><td colspan=2><br><h2>Public Types</h2></td></tr><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td colspan="2"><div class="groupHeader">Overrides from class PObject</div></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPObject.html#z199_0">Comparison</a>&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z215_0">Compare</a> (const <a class="el" href="classPObject.html">PObject</a> &amp;obj) const</td></tr><tr><td colspan="2"><div class="groupHeader">Overrides from class PChannel</div></td></tr><tr><td nowrap align=right valign=top>virtual <a class="el" href="classPString.html">PString</a>&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z217_0">GetName</a> () const</td></tr><tr><td nowrap align=right valign=top>virtual BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z217_1">Read</a> (void *buf, PINDEX len)</td></tr><tr><td nowrap align=right valign=top>virtual BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z217_2">Write</a> (const void *buf, PINDEX len)</td></tr><tr><td nowrap align=right valign=top>virtual BOOL&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#z217_3">Close</a> ()</td></tr><tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr><tr><td nowrap align=right valign=top><a class="el" href="classPFilePath.html">PFilePath</a>&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#n0">subProgName</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>The fully qualified path name for the sub-program executable.</em> <a href="#n0"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#n1">toChildPipe</a> [2]</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#n2">fromChildPipe</a> [2]</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#n3">stderrChildPipe</a> [2]</td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#n4">childPid</a></td></tr><tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="classPPipeChannel.html#n5">retVal</a></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>A channel that uses a operating system pipe between the current process and a sub-process. On platforms that support {\it multi-processing}, the sub-program is executed concurrently with the calling process.<p>Where full multi-processing is not supported then the sub-program is run with its input supplied from, or output captured to, a disk file. The current process is then suspended during the execution of the sub-program. In the latter case the semantics of the <a class="el" href="classPPipeChannel.html#z219_5">Execute()</a># and <a class="el" href="classPPipeChannel.html#z217_3">Close()</a># functions change from the usual for channels.<p>Note that for platforms that do not support multi-processing, the current process is suspended until the sub-program terminates. The input and output of the sub-program is transferred via a temporary file. The exact moment of execution of the sub-program depends on the mode. If mode is <a class="el" href="classPPipeChannel.html#z213_0s0">ReadOnly</a># then it is executed immediately and its output captured. In <a class="el" href="classPPipeChannel.html#z213_0s1">WriteOnly</a># mode the sub-program is run when the <a class="el" href="classPPipeChannel.html#z217_3">Close()</a># function is called, or when the pipe channel is destroyed. In <a class="el" href="classPPipeChannel.html#z213_0s2">ReadWrite</a># mode the sub-program is run when the <a class="el" href="classPPipeChannel.html#z219_5">Execute()</a># function is called indicating that the output from the current process to the sub-program has completed and input is now desired.<p>The <a class="el" href="classPPipeChannel.html#z219_12">CanReadAndWrite()</a># function effectively determines whether full multi-processing is supported by the platform. Note that this is different to whether {\it multi-threading} is supported. <p><hr><h2>Member Enumeration Documentation</h2><a name="z213_0" doxytag="PPipeChannel::OpenMode"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> enum PPipeChannel::OpenMode      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Channel mode for the pipe to the sub-process.<p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="z213_0s0" doxytag="ReadOnly"></a><em>ReadOnly</em></em>&nbsp;</td><td>Pipe is only from the sub-process to the current process.</td></tr><tr><td valign=top><em><a name="z213_0s1" doxytag="WriteOnly"></a><em>WriteOnly</em></em>&nbsp;</td><td>Pipe is only from the current process to the sub-process.</td></tr><tr><td valign=top><em><a name="z213_0s2" doxytag="ReadWrite"></a><em>ReadWrite</em></em>&nbsp;</td><td>Pipe is bidirectional between current and sub-processes.</td></tr><tr><td valign=top><em><a name="z213_0s3" doxytag="ReadWriteStd"></a><em>ReadWriteStd</em></em>&nbsp;</td><td>Pipe is bidirectional between current and sub-processes but the write side goes to stdout and stderr </td></tr></table></dl>    </td>  </tr></table><hr><h2>Constructor &amp; Destructor Documentation</h2><a name="z213_1" doxytag="PPipeChannel::PPipeChannel"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> PPipeChannel::PPipeChannel </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create a new pipe channel.     </td>  </tr></table><a name="z213_2" doxytag="PPipeChannel::PPipeChannel"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> PPipeChannel::PPipeChannel </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="classPString.html">PString</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>subProgram</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>mode</em> = ReadWrite, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>BOOL&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>searchPath</em> = TRUE, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>BOOL&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>stderrSeparate</em> = FALSE</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create a new pipe channel. This executes the subProgram and transfers data from its stdin/stdout/stderr.<p>See the <a class="el" href="classPPipeChannel.html#z219_0">Open()</a># function for details of various parameters. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>mode</em>&nbsp;</td><td>Sub program name or command line. </td></tr><tr><td valign=top><em>searchPath</em>&nbsp;</td><td>Mode for the pipe channel. </td></tr><tr><td valign=top><em>stderrSeparate</em>&nbsp;</td><td>Flag for system PATH to be searched. Standard error is on separate pipe </td></tr></table></dl>    </td>  </tr></table><a name="z213_3" doxytag="PPipeChannel::PPipeChannel"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> PPipeChannel::PPipeChannel </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="classPString.html">PString</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>subProgram</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>const <a class="el" href="classPStringArray.html">PStringArray</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>argumentList</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>mode</em> = ReadWrite, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>BOOL&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>searchPath</em> = TRUE, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>BOOL&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>stderrSeparate</em> = FALSE</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create a new pipe channel. This executes the subProgram and transfers data from its stdin/stdout/stderr.<p>See the <a class="el" href="classPPipeChannel.html#z219_0">Open()</a># function for details of various parameters. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>argumentList</em>&nbsp;</td><td>Sub program name or command line. </td></tr><tr><td valign=top><em>mode</em>&nbsp;</td><td>Array of arguments to sub-program. </td></tr><tr><td valign=top><em>searchPath</em>&nbsp;</td><td>Mode for the pipe channel. </td></tr><tr><td valign=top><em>stderrSeparate</em>&nbsp;</td><td>Flag for system PATH to be searched. Standard error is on separate pipe </td></tr></table></dl>    </td>  </tr></table><a name="z213_4" doxytag="PPipeChannel::PPipeChannel"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> PPipeChannel::PPipeChannel </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="classPString.html">PString</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>subProgram</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>const <a class="el" href="classPStringToString.html">PStringToString</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>environment</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap><a class="el" href="classPPipeChannel.html#z213_0">OpenMode</a>&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>mode</em> = ReadWrite, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>BOOL&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>searchPath</em> = TRUE, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>BOOL&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>stderrSeparate</em> = FALSE</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Create a new pipe channel. This executes the subProgram and transfers data from its stdin/stdout/stderr.<p>See the <a class="el" href="classPPipeChannel.html#z219_0">Open()</a># function for details of various parameters. <dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>environment</em>&nbsp;</td><td>Sub program name or command line. </td></tr><tr><td valign=top><em>mode</em>&nbsp;</td><td>Array of arguments to sub-program. </td></tr><tr><td valign=top><em>searchPath</em>&nbsp;</td><td>Mode for the pipe channel. </td></tr><tr><td valign=top><em>stderrSeparate</em>&nbsp;</td><td>Flag for system PATH to be searched. Standard error is on separate pipe </td></tr></table></dl>    </td>  </tr></table><a name="z213_5" doxytag="PPipeChannel::PPipeChannel"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> PPipeChannel::PPipeChannel </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="classPString.html">PString</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>subProgram</em>, </td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -