While making a state system that follows the state design pattern (which is working quite well so far) and I am now wondering if there is a way to send arbitrary data to this system. I was thinking that this might be possible using a Stimulus class.
The system itself is composited into another object that can respond to the stimuli, and both the state machine and the states themselves can have stimuli as well, and they will be passed from the outer to the inner levels via function calls. The problem being that the stimuli need to carry arbitrary data to these different levels, and I can't think of a simple way to get it out.
I was thinking that it might be possible using a dynamic_cast
, but I was wondering if there might be a better way.