I am working on an application the will need to sequentially encode/decode a series of bytes, and put them to a stream once they have been processed.
My plan was to subclass ostream and provide a constructor MyEncodeStream(istream)
using istream.
I must admit though I am at a loss as to what to do next, which methods should be overridden? What is the standard facility for doing this.
Please provide example code for a this simple case:
- A char is pulled from the input buffer
- The char is manipulated by char
manipulationFunc(char in)
- The char is put to a buffer
- MyEncodeStream stops blocking so the char can be read
- Does ostream provide a read function that should be overridden which operator << calls, or is operator<< the function that should be overridden?