.TH "redi::basic_rpstream" 3 "Thu Nov 10 2011" "PStreams" \" -*- nroff -*- .ad l .nh .SH NAME redi::basic_rpstream \- .PP template for Restricted PStreams. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBredi::pstream_common< CharT, Traits >\fP, and \fBredi::pstreams\fP. .SS "Public Types" .in +1c .ti -1c .RI "typedef \fBpbase_type::pmode\fP \fBpmode\fP" .br .RI "\fIType used to specify how to connect to the process. \fP" .ti -1c .RI "typedef \fBpbase_type::argv_type\fP \fBargv_type\fP" .br .RI "\fIType used to hold the arguments for a command. \fP" .ti -1c .RI "typedef int \fBfd_type\fP" .br .RI "\fIType used for file descriptors. \fP" .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBbasic_rpstream\fP ()" .br .RI "\fIDefault constructor, creates an uninitialised stream. \fP" .ti -1c .RI "\fBbasic_rpstream\fP (const std::string &command, \fBpmode\fP mode=\fBpstdout\fP|\fBpstdin\fP)" .br .RI "\fIConstructor that initialises the stream by starting a process. \fP" .ti -1c .RI "\fBbasic_rpstream\fP (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fP mode=\fBpstdout\fP|\fBpstdin\fP)" .br .RI "\fIConstructor that initialises the stream by starting a process. \fP" .ti -1c .RI "\fB~basic_rpstream\fP ()" .br .RI "\fIDestructor. \fP" .ti -1c .RI "void \fBopen\fP (const std::string &command, \fBpmode\fP mode=\fBpstdout\fP|\fBpstdin\fP)" .br .RI "\fIStart a process. \fP" .ti -1c .RI "void \fBopen\fP (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fP mode=\fBpstdout\fP|\fBpstdin\fP)" .br .RI "\fIStart a process. \fP" .ti -1c .RI "istream_type & \fBout\fP ()" .br .RI "\fIObtain a reference to the istream that reads the process' \fCstdout\fP. \fP" .ti -1c .RI "istream_type & \fBerr\fP ()" .br .RI "\fIObtain a reference to the istream that reads the process' \fCstderr\fP. \fP" .in -1c .SS "Static Public Attributes" .in +1c .ti -1c .RI "static const \fBpmode\fP \fBpstdin\fP = std::ios_base::out" .br .RI "\fIWrite to stdin. \fP" .ti -1c .RI "static const \fBpmode\fP \fBpstdout\fP = std::ios_base::in" .br .RI "\fIRead from stdout. \fP" .ti -1c .RI "static const \fBpmode\fP \fBpstderr\fP = std::ios_base::app" .br .RI "\fIRead from stderr. \fP" .in -1c .SS "Protected Types" .in +1c .ti -1c .RI "enum { \fBbufsz\fP = 32 }" .br .ti -1c .RI "enum { \fBpbsz\fP = 2 }" .br .in -1c .SS "Private Types" .in +1c .ti -1c .RI "typedef \fBbasic_pstreambuf\fP< CharT, Traits > \fBstreambuf_type\fP" .br .ti -1c .RI "enum { \fBbufsz\fP = 32 }" .br .ti -1c .RI "enum { \fBpbsz\fP = 2 }" .br .ti -1c .RI "typedef int \fBfd_type\fP" .br .RI "\fIType used for file descriptors. \fP" .in -1c .SS "Private Member Functions" .in +1c .ti -1c .RI "void \fBdo_open\fP (const std::string &command, \fBpmode\fP mode)" .br .RI "\fIStart a process. \fP" .ti -1c .RI "void \fBdo_open\fP (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fP mode)" .br .RI "\fIStart a process. \fP" .ti -1c .RI "void \fBclose\fP ()" .br .RI "\fIClose the pipe. \fP" .ti -1c .RI "bool \fBis_open\fP () const " .br .RI "\fIReport whether the stream's buffer has been initialised. \fP" .ti -1c .RI "const std::string & \fBcommand\fP () const " .br .RI "\fIReturn the command used to initialise the stream. \fP" .ti -1c .RI "\fBstreambuf_type\fP * \fBrdbuf\fP () const " .br .RI "\fIReturn a pointer to the stream buffer. \fP" .in -1c .SS "Private Attributes" .in +1c .ti -1c .RI "std::string \fBcommand_\fP" .br .RI "\fIThe command used to start the process. \fP" .ti -1c .RI "\fBstreambuf_type\fP \fBbuf_\fP" .br .RI "\fIThe stream buffer. \fP" .in -1c .SS "Static Private Attributes" .in +1c .ti -1c .RI "static const \fBpmode\fP \fBpstdin\fP = std::ios_base::out" .br .RI "\fIWrite to stdin. \fP" .ti -1c .RI "static const \fBpmode\fP \fBpstdout\fP = std::ios_base::in" .br .RI "\fIRead from stdout. \fP" .ti -1c .RI "static const \fBpmode\fP \fBpstderr\fP = std::ios_base::app" .br .RI "\fIRead from stderr. \fP" .in -1c .SH "Detailed Description" .PP .SS "template>class redi::basic_rpstream< CharT, Traits >" template for Restricted PStreams. Writing to an rpstream opened with \fCpmode\fP \fCpstdin\fP writes to the standard input of the command. It is not possible to read directly from an rpstream object, to use an rpstream as in istream you must call either \fBbasic_rpstream::out()\fP or \fBbasic_rpstream::err()\fP. This is to prevent accidental reads from the wrong input source. If the rpstream was not opened with \fCpmode\fP \fCpstderr\fP then the class cannot read the process' \fCstderr\fP, and \fBbasic_rpstream::err()\fP will return an istream that reads from the process' \fCstdout\fP, and vice versa. Reading from an rpstream opened with \fCpmode\fP \fCpstdout\fP and/or \fCpstderr\fP reads the command's standard output and/or standard error. Any of the process' \fCstdin\fP, \fCstdout\fP or \fCstderr\fP that is not connected to the pstream (as specified by the \fCpmode\fP) will be the same as the process that created the pstream object, unless altered by the command itself. .SH "Constructor & Destructor Documentation" .PP .SS "template> \fBredi::basic_rpstream\fP< CharT, Traits >::\fBbasic_rpstream\fP (const std::string &command, \fBpmode\fPmode = \fC\fBpstdout\fP|\fBpstdin\fP\fP)\fC [inline]\fP" .PP Constructor that initialises the stream by starting a process. Initialises the stream buffer by calling \fBdo_open()\fP with the supplied arguments. .PP \fBParameters:\fP .RS 4 \fIcommand\fP a string containing a shell command. .br \fImode\fP the I/O mode to use when opening the pipe. .RE .PP \fBSee also:\fP .RS 4 \fBdo_open(const std::string&, pmode)\fP .RE .PP .SS "template> \fBredi::basic_rpstream\fP< CharT, Traits >::\fBbasic_rpstream\fP (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fPmode = \fC\fBpstdout\fP|\fBpstdin\fP\fP)\fC [inline]\fP" .PP Constructor that initialises the stream by starting a process. Initialises the stream buffer by calling \fBdo_open()\fP with the supplied arguments. .PP \fBParameters:\fP .RS 4 \fIfile\fP a string containing the pathname of a program to execute. .br \fIargv\fP a vector of argument strings passed to the new program. .br \fImode\fP the I/O mode to use when opening the pipe. .RE .PP \fBSee also:\fP .RS 4 \fBdo_open(const std::string&, const argv_type&, pmode)\fP .RE .PP .SH "Member Function Documentation" .PP .SS "template> istream_type& \fBredi::basic_rpstream\fP< CharT, Traits >::err ()\fC [inline]\fP" .PP Obtain a reference to the istream that reads the process' \fCstderr\fP. \fBReturns:\fP .RS 4 \fC*this\fP .RE .PP .PP References redi::pstream_common< CharT, Traits >::buf_, and redi::basic_pstreambuf< CharT, Traits >::read_err(). .SS "template> void \fBredi::basic_rpstream\fP< CharT, Traits >::open (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fPmode = \fC\fBpstdout\fP|\fBpstdin\fP\fP)\fC [inline]\fP" .PP Start a process. Calls do_open( \fIfile\fP , \fIargv\fP , \fImode\fP ). .PP \fBParameters:\fP .RS 4 \fIfile\fP a string containing the pathname of a program to execute. .br \fIargv\fP a vector of argument strings passed to the new program. .br \fImode\fP the I/O mode to use when opening the pipe. .RE .PP \fBSee also:\fP .RS 4 \fBdo_open(const std::string&, const argv_type&, pmode)\fP .RE .PP .PP References redi::pstream_common< CharT, Traits >::do_open(). .SS "template> void \fBredi::basic_rpstream\fP< CharT, Traits >::open (const std::string &command, \fBpmode\fPmode = \fC\fBpstdout\fP|\fBpstdin\fP\fP)\fC [inline]\fP" .PP Start a process. Calls do_open( \fIcommand\fP , \fImode\fP ). .PP \fBParameters:\fP .RS 4 \fIcommand\fP a string containing a shell command. .br \fImode\fP the I/O mode to use when opening the pipe. .RE .PP \fBSee also:\fP .RS 4 \fBdo_open(const std::string&, pmode)\fP .RE .PP .PP References redi::pstream_common< CharT, Traits >::do_open(). .SS "template> istream_type& \fBredi::basic_rpstream\fP< CharT, Traits >::out ()\fC [inline]\fP" .PP Obtain a reference to the istream that reads the process' \fCstdout\fP. \fBReturns:\fP .RS 4 \fC*this\fP .RE .PP .PP References redi::pstream_common< CharT, Traits >::buf_, and redi::basic_pstreambuf< CharT, Traits >::read_err(). .SH "Author" .PP Generated automatically by Doxygen for PStreams from the source code.