I have another question following on from my previous question about abstractions, I have another problem in relation to setting data at the event once it has been created.
As things stand, I can create events of any type and apply their data no problem (using a modified version of the strategy design pattern). The problem is that I currently have to pass the event its data when it is created.
IEvent* newEvent = new SpeedEvent( eventID, interpolation, 50.0f );
or
IEvent* newEvent = new AnimationEvent( eventID, interpolation, &newAnimation );
This method is fine when I know what the data is at creation of the object, but there are many cases where I won't know what the data will be in instantiation.
What would be ideal, would be to create a new event as such:
IEvent* newEvent = new SpeedEvent( eventID, interpolation );
And then assign it data in this fashion:
eventManager->assignData( eventID, *unknown data type* );
This way, I would let the object handle the data in its own way. Any suggestions as to how to solve this problem would be much appreciated, however I really want to avoid using templates if I can.
My current data and object structure is very similar to the one suggested in the answer to my previous question.