.TH "redi::pstream_common" 3 "Thu Nov 10 2011" "PStreams" \" -*- nroff -*- .ad l .nh .SH NAME redi::pstream_common \- .PP Class template for common base class. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBredi::pstreams\fP. .PP Inherited by \fBredi::basic_ipstream< CharT, Traits >\fP, \fBredi::basic_opstream< CharT, Traits >\fP, \fBredi::basic_pstream< CharT, Traits >\fP, and \fBredi::basic_rpstream< CharT, Traits >\fP\fC [private]\fP. .SS "Public Types" .in +1c .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 "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 "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 "typedef \fBbasic_pstreambuf\fP< CharT, Traits > \fBstreambuf_type\fP" .br .ti -1c .RI "typedef \fBpstreams::pmode\fP \fBpmode\fP" .br .RI "\fIType used to specify how to connect to the process. \fP" .ti -1c .RI "typedef \fBpstreams::argv_type\fP \fBargv_type\fP" .br .RI "\fIType used to hold the arguments for a command. \fP" .ti -1c .RI "enum { \fBbufsz\fP = 32 }" .br .ti -1c .RI "enum { \fBpbsz\fP = 2 }" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "\fBpstream_common\fP ()" .br .RI "\fIDefault constructor. \fP" .ti -1c .RI "\fBpstream_common\fP (const std::string &command, \fBpmode\fP mode)" .br .RI "\fIConstructor that initialises the stream by starting a process. \fP" .ti -1c .RI "\fBpstream_common\fP (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fP mode)" .br .RI "\fIConstructor that initialises the stream by starting a process. \fP" .ti -1c .RI "virtual \fB~pstream_common\fP ()=0" .br .RI "\fIPure virtual destructor. \fP" .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" .in -1c .SS "Protected 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 .SH "Detailed Description" .PP .SS "template>class redi::pstream_common< CharT, Traits >" Class template for common base class. Abstract Base Class providing common functionality for \fBbasic_ipstream\fP, \fBbasic_opstream\fP and \fBbasic_pstream\fP. \fBpstream_common\fP manages the \fBbasic_pstreambuf\fP stream buffer that is used by the derived classes to initialise an iostream class. .SH "Constructor & Destructor Documentation" .PP .SS "template \fBredi::pstream_common\fP< C, T >::\fBpstream_common\fP ()\fC [inline, protected]\fP" .PP Default constructor. Creates an uninitialised stream. .PP References redi::pstream_common< CharT, Traits >::buf_. .SS "template \fBredi::pstream_common\fP< C, T >::\fBpstream_common\fP (const std::string &command, \fBpmode\fPmode)\fC [inline, protected]\fP" .PP Constructor that initialises the stream by starting a process. Initialises the stream buffer by calling 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 >::buf_, and redi::pstream_common< CharT, Traits >::do_open(). .SS "template \fBredi::pstream_common\fP< C, T >::\fBpstream_common\fP (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fPmode)\fC [inline, protected]\fP" .PP Constructor that initialises the stream by starting a process. Initialises the stream buffer by calling 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 >::buf_, and redi::pstream_common< CharT, Traits >::do_open(). .SS "template \fBredi::pstream_common\fP< C, T >::~\fBpstream_common\fP ()\fC [inline, protected, pure virtual]\fP" .PP Pure virtual destructor. This is a pure virtual function to make \fC\fBpstream_common\fP\fP abstract. Because it is the destructor it will be called by derived classes and so must be defined. It is also protected, to discourage use of the PStreams classes through pointers or references to the base class. .PP \fBSee also:\fP .RS 4 If defining a pure virtual seems odd you should read http://www.gotw.ca/gotw/031.htm (and the rest of the site as well!) .RE .PP .SH "Member Function Documentation" .PP .SS "template void \fBredi::pstream_common\fP< C, T >::close ()\fC [inline]\fP" .PP Close the pipe. Calls rdbuf->\fBclose()\fP and sets \fCfailbit\fP on error. .SS "template const std::string & \fBredi::pstream_common\fP< C, T >::command () const\fC [inline]\fP" .PP Return the command used to initialise the stream. \fBReturns:\fP .RS 4 a string containing the command used to initialise the stream. .RE .PP .SS "template void \fBredi::pstream_common\fP< C, T >::do_open (const std::string &file, const \fBargv_type\fP &argv, \fBpmode\fPmode)\fC [inline, protected]\fP" .PP Start a process. Calls \fBrdbuf()\fP->open( \fIfile\fP, \fIargv\fP, \fImode\fP ) and sets \fCfailbit\fP on error. .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 \fBbasic_pstreambuf::open(const std::string&, const argv_type&, pmode)\fP .RE .PP .SS "template void \fBredi::pstream_common\fP< C, T >::do_open (const std::string &command, \fBpmode\fPmode)\fC [inline, protected]\fP" .PP Start a process. Calls \fBrdbuf()\fP->open( \fIcommand\fP , \fImode\fP ) and sets \fCfailbit\fP on error. .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 \fBbasic_pstreambuf::open(const std::string&, pmode)\fP .RE .PP .PP Referenced by redi::basic_rpstream< CharT, Traits >::open(), redi::basic_pstream< CharT, Traits >::open(), redi::basic_opstream< CharT, Traits >::open(), redi::basic_ipstream< CharT, Traits >::open(), and redi::pstream_common< CharT, Traits >::pstream_common(). .SS "template bool \fBredi::pstream_common\fP< C, T >::is_open () const\fC [inline]\fP" .PP Report whether the stream's buffer has been initialised. \fBReturns:\fP .RS 4 \fBrdbuf()\fP->\fBis_open()\fP. .RE .PP \fBSee also:\fP .RS 4 \fBbasic_pstreambuf::is_open()\fP .RE .PP .SS "template \fBpstream_common\fP< C, T >::\fBstreambuf_type\fP * \fBredi::pstream_common\fP< C, T >::rdbuf () const\fC [inline]\fP" .PP Return a pointer to the stream buffer. \fBReturns:\fP .RS 4 a pointer to the private stream buffer member. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for PStreams from the source code.