New Stream Types
-
This is a standard C++ question rather than Visual C++ specific. I'm trying to figure out how to make new types of streams (aka not stdio or file io related) and I'm not sure where to start. A few of the vague articles I read stated I must subclass a streambuf but the member functions are not well named nor well documented. :confused: Essentially I'm trying to build a clean portable IPC library (well portable in that the interface is portable :) ) and the cleanest way I can think of is using customized streams (socket-stream,memory-stream,pipe-stream,memory-mapped-file-stream etc). Can anyone point me in the right direction or to a suitable article or set of articles? I know there is a book or two out there but the only one suitable is a bit beyond a broke student's resources. I would appricate any assistance in any form. Sean Cody (NullStream) "As long as you want to live, everywhere will become heaven. Afterall, you are still alive." - End Of Evanglion
-
This is a standard C++ question rather than Visual C++ specific. I'm trying to figure out how to make new types of streams (aka not stdio or file io related) and I'm not sure where to start. A few of the vague articles I read stated I must subclass a streambuf but the member functions are not well named nor well documented. :confused: Essentially I'm trying to build a clean portable IPC library (well portable in that the interface is portable :) ) and the cleanest way I can think of is using customized streams (socket-stream,memory-stream,pipe-stream,memory-mapped-file-stream etc). Can anyone point me in the right direction or to a suitable article or set of articles? I know there is a book or two out there but the only one suitable is a bit beyond a broke student's resources. I would appricate any assistance in any form. Sean Cody (NullStream) "As long as you want to live, everywhere will become heaven. Afterall, you are still alive." - End Of Evanglion
Let me save you a lot of time. Go out and buy yourself a copy of "Standard C++ Iostreams and Locales" By Langer and Kreft. It discusses in the most minute possible detail how to create your own streambuffer class and use it in a stream. Basically what you do when you create a streambuffer class is first decide 1. Will it handle input? 2. Will it handle output? 3. Will it handle both simultaneously? The answer to these questions determines the level of complexity involved in coding it. Once you have determines that, you then know which functions you need to implement. The functions you implement are PRIVATE VIRTUAL functions. For example, you should not implement 'pubsync' because that it a public, non-virtual function. But you would implement 'sync' because that is a private, virtual function (and generally is what 'pubsync' calls anyway). The topic is a big one. At the moment, I'm trying to write my own streambuffer for Winsock. I've seen a couple of implementations of this on the web, but I'm doing my own mainly as a learning experience. Joe O'Leary