#include <PStreamBuf.h>
Inheritance diagram for PLearn::PStreamBuf:
Public Types | |
typedef PPointable | inherited |
typedef size_t | streamsize |
typedef off_t | streampos |
Public Member Functions | |
PStreamBuf (streamsize inbuf_capacity=1000, streamsize outbuf_capacity=1000, streamsize unget_capacity=100) | |
Default constructor SUBCLASS WRITING:subclasse should also correctly set is_readable, is_writable, is_random_accessible. | |
virtual | ~PStreamBuf () |
bool | isReadable () const |
bool | isWritable () const |
bool | isRandomAccessible () const |
int | get () |
int | peek () |
streamsize | read (char *p, streamsize n) |
void | unread (const char *p, streamsize n) |
puts the given characters back in the input buffer so that they're the next thing read. | |
void | unget (char c) |
void | flush () |
void | put (char c) |
void | write (const char *p, streamsize n) |
Protected Member Functions | |
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) Default version issues a PLERROR | |
Protected Attributes | |
bool | is_readable |
bool | is_writable |
bool | is_random_accessible |
is random access supported? (setpos and getpos) | |
Private Member Functions | |
void | build_ () |
This does the actual building. | |
streamsize | refill_in_buf () |
Private Attributes | |
streamsize | ungetsize |
streamsize | inbuf_chunksize |
char * | inbuf |
beginning of input buffer | |
char * | inbuf_p |
position of next character to be read | |
char * | inbuf_end |
one after last available character | |
streamsize | outbuf_chunksize |
char * | outbuf |
beginning of output buffer | |
char * | outbuf_p |
position of next character to be written | |
char * | outbuf_end |
one after last reserved character in outbuf |
|
Reimplemented in PLearn::FilePStreamBuf, and PLearn::StdPStreamBuf. Definition at line 55 of file PStreamBuf.h. |
|
Definition at line 57 of file PStreamBuf.h. |
|
Definition at line 56 of file PStreamBuf.h. Referenced by flush(), read(), read_(), refill_in_buf(), and write(). |
|
Default constructor SUBCLASS WRITING:subclasse should also correctly set is_readable, is_writable, is_random_accessible.
Definition at line 45 of file PStreamBuf.cc. References build_(). |
|
Definition at line 59 of file PStreamBuf.cc. |
|
This does the actual building.
Reimplemented in PLearn::FilePStreamBuf. Definition at line 70 of file PStreamBuf.cc. References flush(), inbuf, inbuf_chunksize, inbuf_end, inbuf_p, outbuf, outbuf_chunksize, outbuf_end, outbuf_p, and ungetsize. Referenced by PStreamBuf(). |
|
Definition at line 229 of file PStreamBuf.h. References outbuf, outbuf_p, and streamsize. Referenced by build_(), put(), write(), and ~PStreamBuf(). |
|
Definition at line 148 of file PStreamBuf.h. References inbuf_end, inbuf_p, and refill_in_buf(). |
|
Definition at line 145 of file PStreamBuf.h. References is_random_accessible. |
|
Definition at line 139 of file PStreamBuf.h. References is_readable. Referenced by read(), and refill_in_buf(). |
|
Definition at line 142 of file PStreamBuf.h. References is_writable. |
|
Definition at line 156 of file PStreamBuf.h. References inbuf_end, inbuf_p, and refill_in_buf(). |
|
Definition at line 239 of file PStreamBuf.h. References flush(), isWritable(), outbuf_end, outbuf_p, PLERROR, and put(). Referenced by put(). |
|
Definition at line 165 of file PStreamBuf.h. References inbuf_chunksize, inbuf_end, inbuf_p, isReadable(), k, PLERROR, refill_in_buf(), and streamsize. |
|
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 in PLearn::FilePStreamBuf, and PLearn::StdPStreamBuf. Definition at line 94 of file PStreamBuf.cc. References PLERROR, and streamsize. |
|
Definition at line 124 of file PStreamBuf.h. References inbuf, inbuf_chunksize, inbuf_end, inbuf_p, isReadable(), PLERROR, streamsize, and ungetsize. |
|
Definition at line 219 of file PStreamBuf.h. References inbuf, inbuf_p, PLERROR, and unget(). Referenced by unget(). |
|
puts the given characters back in the input buffer so that they're the next thing read.
Definition at line 209 of file PStreamBuf.h. References inbuf, inbuf_p, PLERROR, and unread(). Referenced by unread(). |
|
Definition at line 250 of file PStreamBuf.h. References flush(), isWritable(), outbuf_chunksize, outbuf_end, outbuf_p, PLERROR, and streamsize. |
|
writes exactly n characters from p (unbuffered, must flush) Default version issues a PLERROR
Reimplemented in PLearn::FilePStreamBuf, and PLearn::StdPStreamBuf. Definition at line 102 of file PStreamBuf.cc. References PLERROR. |
|
beginning of input buffer
Definition at line 87 of file PStreamBuf.h. Referenced by build_(), refill_in_buf(), unget(), unread(), and ~PStreamBuf(). |
|
Definition at line 86 of file PStreamBuf.h. Referenced by build_(), read(), and refill_in_buf(). |
|
one after last available character
Definition at line 89 of file PStreamBuf.h. Referenced by build_(), get(), peek(), read(), and refill_in_buf(). |
|
position of next character to be read
Definition at line 88 of file PStreamBuf.h. Referenced by build_(), get(), peek(), read(), refill_in_buf(), unget(), and unread(). |
|
is random access supported? (setpos and getpos)
Definition at line 101 of file PStreamBuf.h. Referenced by isRandomAccessible(). |
|
Definition at line 99 of file PStreamBuf.h. Referenced by isReadable(). |
|
Definition at line 100 of file PStreamBuf.h. Referenced by isWritable(). |
|
beginning of output buffer
Definition at line 93 of file PStreamBuf.h. Referenced by build_(), flush(), and ~PStreamBuf(). |
|
Definition at line 92 of file PStreamBuf.h. |
|
one after last reserved character in outbuf
Definition at line 95 of file PStreamBuf.h. |
|
position of next character to be written
Definition at line 94 of file PStreamBuf.h. |
|
Definition at line 85 of file PStreamBuf.h. Referenced by build_(), and refill_in_buf(). |