|
|
1.1 ! root 1: . \"ident "%W%" ! 2: . \"Copyright (c) 1984 AT&T ! 3: . \"All Rights Reserved ! 4: . \"THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T ! 5: . \"The copyright notice above does not evidence any ! 6: . \"actual or intended publication of such source code. ! 7: .TH PIPEBUF 3I+ "C++ Stream Library" " " ! 8: .SH NAME ! 9: pipebuf \- streambuf specialized as circular queue ! 10: .SH SYNOPSIS ! 11: .nf ! 12: .ft B ! 13: .ta1i 2i ! 14: #include <iostream.h> ! 15: #include <pipestream.h> ! 16: ! 17: class pipebuf : streambuf { ! 18: pipebuf(); ! 19: int empty(); ! 20: int full(); ! 21: streambuf* setbuf(char* ptr, int len); ! 22: } ; ! 23: .ft R ! 24: .fi ! 25: .SH DESCRIPTION ! 26: A \f(CWpipebuf\fR ! 27: uses its reserve area to support a circular ! 28: queue of characters. ! 29: In terms of the abstract notion of buffer a \f(CWpipebuf\fR ! 30: is a potentially infinite sequence in which the put pointer ! 31: and get pointer move independently. ! 32: The put pointer is always at the end of the sequence, and ! 33: puts extend the sequence. ! 34: As long as the get pointer remains behind the put pointer, but ! 35: not too far behind, fetching and storing can continue indefinitely. ! 36: Seeks are not supported. ! 37: .PP ! 38: Assume ! 39: .br ! 40: \(em \fBpb\fR is a \f(CWpipebuf\fR. ! 41: .br ! 42: \(em \fBptr\fR is a \f(CWchar*\fR. ! 43: .br ! 44: \(em \fBi\fR and \fBlen\fR are an \f(CWint\fR. ! 45: .br ! 46: \(em \fBsb\fR is \f(CWstreambuf*\fR. ! 47: .PP ! 48: Constructor: ! 49: .TP ! 50: \fBpipebuf()\fR ! 51: Constructs an empty buffer. ! 52: .PP ! 53: Members: ! 54: .TP ! 55: \fBi=pb.empty()\fR ! 56: Returns non-zero if the get pointer is at the end of the sequence, ! 57: and attempts to get characters will therefore fail. ! 58: .TP ! 59: \fBi=pb.full()\fR ! 60: Returns non-zero if there is no more room for putting ! 61: characters. In the current implementation, the capacity of ! 62: the buffer is one less than the size of the reserve area. ! 63: .TP ! 64: \fBsb=pb.setbuf(ptr,len)\fR ! 65: Establishes the \fBlen\fR bytes starting at \fBptr\fR ! 66: as the reserve area. Normally it will return \fB&pb\fR. But ! 67: it will return a null pointer if it fails. Failure occurs ! 68: if \fBpb.empty()\fR is zero, or if \fBlen\fR is less than 2. ! 69: .SH CAVEATS ! 70: There ought to be a version with an unbounded capacity. ! 71: .SH SEE ALSO ! 72: streambuf(3C++) ! 73: pipestream(3C++)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.