Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. New Stream Types

New Stream Types

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionperformancetutoriallearning
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NullStream
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • N NullStream

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups