Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::StdPStreamBuf Class Reference

#include <StdPStreamBuf.h>

Inheritance diagram for PLearn::StdPStreamBuf:

Inheritance graph
[legend]
Collaboration diagram for PLearn::StdPStreamBuf:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 StdPStreamBuf ()
 StdPStreamBuf (istream *pin_, bool own_pin_=false)
 ctor. from an istream (I)

 StdPStreamBuf (ostream *pout_, bool own_pout_=false)
 ctor. from an ostream (O)

 StdPStreamBuf (iostream *pios_, bool own_pios_=false)
 ctor. from an iostream (IO)

 StdPStreamBuf (istream *pin_, ostream *pout_, bool own_pin_=false, bool own_pout_=false)
 ctor. from an istream and an ostream (IO)

virtual ~StdPStreamBuf ()
void setIn (istream *pin_, bool own_pin_=false)
void setOut (ostream *pout_, bool own_pout_=false)
void attach (int fd)
 attach: "attach" to a POSIX file descriptor.

istream * rawin ()
ostream * rawout ()
pl_streambufpl_rdbuf ()
 returns the markable input buffer DEPRECATED: TO BE REMOVED SOON, DO NOT USE!


Protected Member Functions

void initInBuf ()
 initInBuf: called by ctors. to ensure that pin's buffer is markable

virtual streamsize read_ (char *p, streamsize n)
 reads up to n characters into p You should override this call in subclasses.

virtual void write_ (const char *p, streamsize n)
 writes exactly n characters from p (unbuffered, must flush)


Protected Attributes

istream * pin
ostream * pout
bool own_pin
bool own_pout
PP< pl_streambufthe_inbuf
PP< pl_fdstreambufthe_fdbuf
streambuforiginal_bufin
 ptrs.

streambuforiginal_bufout

Private Types

typedef PStreamBuf inherited

Member Typedef Documentation

typedef PStreamBuf PLearn::StdPStreamBuf::inherited [private]
 

Reimplemented from PLearn::PStreamBuf.

Definition at line 64 of file StdPStreamBuf.h.


Constructor & Destructor Documentation

PLearn::StdPStreamBuf::StdPStreamBuf  ) 
 

Definition at line 50 of file StdPStreamBuf.cc.

References if(), and STREAMBUFVER.

PLearn::StdPStreamBuf::StdPStreamBuf istream *  pin_,
bool  own_pin_ = false
 

ctor. from an istream (I)

Definition at line 58 of file StdPStreamBuf.cc.

References if(), initInBuf(), and STREAMBUFVER.

PLearn::StdPStreamBuf::StdPStreamBuf ostream *  pout_,
bool  own_pout_ = false
 

ctor. from an ostream (O)

Definition at line 70 of file StdPStreamBuf.cc.

References if(), and STREAMBUFVER.

PLearn::StdPStreamBuf::StdPStreamBuf iostream pios_,
bool  own_pios_ = false
 

ctor. from an iostream (IO)

Definition at line 78 of file StdPStreamBuf.cc.

References if(), initInBuf(), and STREAMBUFVER.

PLearn::StdPStreamBuf::StdPStreamBuf istream *  pin_,
ostream *  pout_,
bool  own_pin_ = false,
bool  own_pout_ = false
 

ctor. from an istream and an ostream (IO)

Definition at line 90 of file StdPStreamBuf.cc.

References if(), initInBuf(), and STREAMBUFVER.

PLearn::StdPStreamBuf::~StdPStreamBuf  )  [virtual]
 

Definition at line 101 of file StdPStreamBuf.cc.

References original_bufin, original_bufout, own_pin, own_pout, pin, pout, and the_inbuf.


Member Function Documentation

void PLearn::StdPStreamBuf::attach int  fd  ) 
 

attach: "attach" to a POSIX file descriptor.

Definition at line 160 of file StdPStreamBuf.cc.

References own_pin, own_pout, pin, PLearn::pl_dftbuflen, pout, the_fdbuf, and the_inbuf.

void PLearn::StdPStreamBuf::initInBuf  )  [protected]
 

initInBuf: called by ctors. to ensure that pin's buffer is markable

Definition at line 116 of file StdPStreamBuf.cc.

References PLearn::PP< pl_streambuf >::isNull(), pin, and the_inbuf.

Referenced by setIn(), and StdPStreamBuf().

pl_streambuf* PLearn::StdPStreamBuf::pl_rdbuf  )  [inline]
 

returns the markable input buffer DEPRECATED: TO BE REMOVED SOON, DO NOT USE!

Definition at line 134 of file StdPStreamBuf.h.

istream* PLearn::StdPStreamBuf::rawin  )  [inline]
 

Definition at line 128 of file StdPStreamBuf.h.

References pin.

ostream* PLearn::StdPStreamBuf::rawout  )  [inline]
 

Definition at line 129 of file StdPStreamBuf.h.

References pout.

StdPStreamBuf::streamsize PLearn::StdPStreamBuf::read_ char *  p,
streamsize  n
[protected, virtual]
 

reads up to n characters into p You should override this call in subclasses.

On success, the number of bytes read is returned. Zero indicates end of file. If we are not at end of file, at least one character should be returned (the call must block until at least one char is available). It is not an error if the number returned is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually available right now (maybe because we were close to end-of-file, or because we are reading from a pipe, or from a terminal). If an error occurs, an exception should be thrown.

Reimplemented from PLearn::PStreamBuf.

Definition at line 180 of file StdPStreamBuf.cc.

References pin, and PLERROR.

void PLearn::StdPStreamBuf::setIn istream *  pin_,
bool  own_pin_ = false
 

Definition at line 129 of file StdPStreamBuf.cc.

References initInBuf(), original_bufin, own_pin, pin, and the_fdbuf.

void PLearn::StdPStreamBuf::setOut ostream *  pout_,
bool  own_pout_ = false
 

Definition at line 147 of file StdPStreamBuf.cc.

References original_bufout, own_pout, and pout.

void PLearn::StdPStreamBuf::write_ const char *  p,
streamsize  n
[protected, virtual]
 

writes exactly n characters from p (unbuffered, must flush)

Reimplemented from PLearn::PStreamBuf.

Definition at line 188 of file StdPStreamBuf.cc.

References PLERROR, and pout.


Member Data Documentation

streambuf* PLearn::StdPStreamBuf::original_bufin [protected]
 

ptrs.

to the original buffers; used to 'reset' the underlying streams to a valid state when the PStream is destroyed.

Definition at line 80 of file StdPStreamBuf.h.

Referenced by setIn(), and ~StdPStreamBuf().

streambuf* PLearn::StdPStreamBuf::original_bufout [protected]
 

Definition at line 81 of file StdPStreamBuf.h.

Referenced by setOut(), and ~StdPStreamBuf().

bool PLearn::StdPStreamBuf::own_pin [protected]
 

Definition at line 72 of file StdPStreamBuf.h.

Referenced by attach(), setIn(), and ~StdPStreamBuf().

bool PLearn::StdPStreamBuf::own_pout [protected]
 

Definition at line 72 of file StdPStreamBuf.h.

Referenced by attach(), setOut(), and ~StdPStreamBuf().

istream* PLearn::StdPStreamBuf::pin [protected]
 

Definition at line 70 of file StdPStreamBuf.h.

Referenced by attach(), initInBuf(), rawin(), read_(), setIn(), and ~StdPStreamBuf().

ostream* PLearn::StdPStreamBuf::pout [protected]
 

Definition at line 71 of file StdPStreamBuf.h.

Referenced by attach(), rawout(), setOut(), write_(), and ~StdPStreamBuf().

PP<pl_fdstreambuf> PLearn::StdPStreamBuf::the_fdbuf [protected]
 

Definition at line 76 of file StdPStreamBuf.h.

Referenced by attach(), and setIn().

PP<pl_streambuf> PLearn::StdPStreamBuf::the_inbuf [protected]
 

Definition at line 75 of file StdPStreamBuf.h.

Referenced by attach(), initInBuf(), and ~StdPStreamBuf().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:23:15 2004 for PLearn by doxygen 1.3.7