Menu

Tag Archives: Stream

This is more of an obvious avoidable problem than a necessary work/solution. But I needed this on how I was working on my own little “engine”. A couple of months ago, I was working on a Virtual File System. I later discovered that std::fstream has a 4GB limit. So I resorted to using the Stream I/O instead which can handle greater than the 4GB limit. The problem with this is that it isn’t structured in an Object-Oriented way. Yes we want everything to be Object-Oriented. That being said, I ended up wrapping the Stream I/O into a neat simple to use class[1][2].

Now I’m working on a new system which requires a generic way to input and output streams. What I mean is that I want my system to not care where the system is reading in or writing out data. Let it be reading in from an input peripheral, reading from a file, writing to a console or writing to a file. So I designed a very simple abstract I/O stream class. It is broken down into two classes, IStream and OStream, which is derived from a base Stream class[3].

These abstract classes are definitely far from complete. But it seems to serve well for my purpose. So I can at least say that this is a good start.

If you take a look at the implementations provided, you’ll notice that only the FileIO class is currently derived from it right now. I still have to add a bunch of derived classes to encapsulate cin, cout, and a bunch of others that I can think of which is currently in my TODO list that I have to do sometime in the future(no pun intended).