The interleaving part was a lot easier than I was anticipating, but I had to lighten up on my attempt to preserve the test program in its original form. The only change I really made was that I put all data into the same queue instead of having separate queues for the Calc and FSM data.
This was made possible through inheritance. I created a QueueData class with an abstract getDataType() method. Calc_Data and FSM_Data were refactored to inherit from this class. The InputQueue was declared to store QueueData objects, so it could accommodate both types of data. The process() method iterates through the queue, and if getDataType() says it's Calc data, then it calls pCalc.doWork(). Otherwise, it calls pFSM.doWork().
Mission accomplished!
No comments:
Post a Comment