Indexing variables pushed to two different queues

Hi,

I use two different queues (one for command and one for address)
I have a requirement to identify the order in which elements are being pushed to these queue. Typically one such example is listed below:

Cmd_q.push(aa);
Cmd_q.push(bb);
Addr_q.push(add1)
Addr_q.push(add2)
Cmd_q.push(bb);

I need to identify that these information sent is: aa(command)-bb(command)-add1(Address)-add2(Address)-bb(command)

Please suggest possible and easier approach to achieve the same
in method push:

static vector<something> command_order;
...

command_order.push_back(key_and_type);

where something is a struct that holds the data's key (aa, bb, etc or some way to access this, even a pointer to it works) and the type (cmd or addr, possibly the template type or text version thereof for the q class?)

then any q variable can list the historical operations performed on all the qs. Even an empty dummy q variable can take a look at the history.

this is the direct approach. It may not be the best OOP design.
Last edited on
Topic archived. No new replies allowed.