Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  


Well the new thing added to the code library today are streambuf helper classes. They're a pair of classes that derive from streambuf that implement buffering code. The OStreamBuf class adds a pure virtual method, do_write() and the IStreamBuf class adds a do_read(). Basically these get called when the buffers need to get flushed or filled. These helper classes make creating custom streambufs extremely easy. I've used them for redirecting the standard handles for a child process into a iostream, wrapping sockets and tying a stream to an edit control.

And once you have a streambuf you can tie the input into the rest of the standard library pretty easily, especially with stream/streambuf iterators. Or even just using the insertion opreator to dump entire streambufs into a stream. This is just one of the many examples I've found where using the standard library interfaces as a common ground makes for very productive coding.

The current versions of the OStreamBuf and IStreamBuf classes are templated. I might go and create a non-templated version for the common > case. That should cut down on compile times. And after that I'll probably work on my sixth or seventh binary stream class revision.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!