C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Unbuffered basic_streambuf Implementation

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sun Aug 29, 2004 6:29 am    Post subject: Unbuffered basic_streambuf Implementation Reply with quote



Is this even possible? I've found some references to specific "unbuffered"
type methods that exist in older incarnations of basic_streambuf but not in
newer ones.

Info please. :P


Back to top
Jonathan Turkanis
Guest





PostPosted: Sun Aug 29, 2004 4:38 pm    Post subject: Re: Unbuffered basic_streambuf Implementation Reply with quote




<yerl (AT) twenty (DOT) net> wrote

Quote:
Is this even possible? I've found some references to specific "unbuffered"
type methods that exist in older incarnations of basic_streambuf but not in
newer ones.

It's easy to write a stream buffer which performs unbuffered output. Simply
refrain from using the put-area pointer manipulation function setp, etc., and
override overflow (and possibly xsputn) to write directly to the underlying data
sink.

For input, you need a small buffer to support peeking at the next character
without consuming it and putting back a character that has already been
consumed.

Angelika Langer and Kluas Kreft present an unbuffered streambuf implementation
in their text 'Standard C++ Iostreams and Locales', p. 299. Their implementation
uses a buffer of size 1. I believe I found that this implementation does not
work with STLPort, which routinely peeks at the next character internally so
that the putback buffer is always full. So for 'unbuffered' input I always use a
buffer of size at least 2.

I have written an iostreams library which makes it easy to define new streams
and stream buffers. It's up for review for includion in Boost right now. I
encourage anyone who is interested to participate in the review process on the
Boost developers list (see [url]http://www.boost.org/more/mailing_lists.htm#main)[/url].

Jonathan



Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.