Hello!
I am looking for a couple of patterns or design ideas for implementation in C++ that would allow the following.
1.
- pool of similar objects
- objects requested and relinquished by client
- pool grows when exhausted, does not shrink
- there will be multiple clients (one pool per client to avoid mutexing)
An Object Pool seems most appropriate.
2.
The objects obtained from the pool will be data processors that will be chained together dynamically. Each object will perform some operation that may or may not alter the data before passing the data on (or they may terminate the chain).
This requirement has me a little stuck. I was considering something along the lines of a modified Chain of Responsibility where the data will be passed to all.
However, I'm wary of simply plucking pattern from the air and assuming its the best approach so I'd appreciate some feedback, alternative ideas and draw on the experience of others!
Thanks,
Stuart.
Thanks for the feedback so far:
The objects perform decode/analysis/transformation of real-time data. The pool would contain objects various objects derived from the same base class.
A control plane will dynamically create and initialise the chain of objects and the objects according to external criteria.
Format of the data can be explicitly indicated/updated as it passed through the objects. However this is isolated and of little consequence as it known at chain creation.
The strategy pattern deserves some studying.