I'm working on a library that lets me write operation on an input "stream" of data (I don't call them that, but it's a potentially unbounded input regardless, think data coming from a socket).
I might have one operation that eg: applies a frequency shift to the incoming data, and then another that applies a frequency-selective filter to that result, I'm writing in C++ so my syntax might look something like this:
input >> tune >> filter >> output;
My problem is that different operations might require an unknown number of data points to compute the output. So eg: tune perhaps (and can) work with an arbitrary number of inputs at a time, but filter requires some minimum number of samples before it can produce output.
The easiest answer is to run each filter in a thread, and connect them with some sort of thread-safe pipe or equivalent. If possible though, I'd like to avoid threading if I can.
Is anyone aware of an alternative pattern or research on composing streaming/batch operations on a stream without resorting to threads and blocking I/O?