I have several classes that each subclass an Operator.
An Operator has several inputs and outputs, of various types: image, number, string.
Each subclass implements a run() method that does the computation.
Now I would like to design a container for these Operators, to make bigger Operators from the simple ones.
The container should be as efficient as possible, so I’m planning to use threads. I have found an example in the Boost graph library that allows me to compute the order in which I should do the computation: http://www.boost.org/doc/libs/1_49_0/libs/graph/doc/file_dependency_example.html , but I think there may be an even better way to do this: each operator could wait in a blocked state until all of its inputs are ready.
It would be good if the container subclassed Operator, allowing to recursively combine them.
I have a feeling this is a known design pattern.
I have several classes that each subclass an Operator. An Operator has several inputs
Share
I have found a design pattern that matches my description: the composite pattern.
The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object.