Modular Architecture for Processing Pipeline
Posted
by
anjruu
on Programmers
See other posts from Programmers
or by anjruu
Published on 2011-02-16T16:01:14Z
Indexed on
2012/03/23
11:39 UTC
Read the original article
Hit count: 243
design-patterns
|architecture
I am trying to design the architecture of a system that I will be implementing in C++, and I was wondering if people could think of a good approach, or critique the approach that I have designed so far.
First of all, the general problem is an image processing pipeline. It contains several stages, and the goal is to design a highly modular solution, so that any of the stages can be easily swapped out and replaced with a piece of custom code (so that the user can have a speed increase if s/he knows that a certain stage is constrained in a certain way in his or her problem).
The current thinking is something like this:
struct output; /*Contains the output values from the pipeline.*/
class input_routines{
public:
virtual foo stage1(...){...}
virtual bar stage2(...){...}
virtual qux stage3(...){...}
...
}
output pipeline(input_routines stages);
This would allow people to subclass input_routines and override whichever stage they wanted. That said, I've worked in systems like this before, and I find the subclassing and the default stuff tends to get messy, and can be difficult to use, so I'm not giddy about writing one myself. I was also thinking about a more STLish approach, where the different stages (there are 6 or 7) would be defaulted template parameters.
Can anyone offer a critique of the pattern above, thoughts on the template approach, or any other architecture that comes to mind?
© Programmers or respective owner