Yeah, I proposed maps and made an example of a working system in the thread I linked to.
Actually since I am seeking technically a map between one definition to another (both of which are number based, even though they technically use different mathematical bases) I think a map would do just fine for what I need to accomplish.
0x034 (e.g.) needs to be mapped to 15
thus when the msg 0x034 comes in to my message handler, I access the appropriate function pointer via... ptrArray[15](parameters);
Thanks for the advise Elysia, a great help as always
Well, you don't really need to re-map the number of message at all. Since all messages have unique numbers, you can just map them to a function pointer directly, if you wish and pass any argument you think may be useful.
The map example I made in the other thread is just a basic map-to-pointer example. If you modify the function pointer typedef, you should be able to map whatever number you want into appropriate function pointer and function handler.
It's open to modifications.
Perfect. I guess I was so wrapped up in my own concept idea, it didn't even occur to me to take my own defines out of the equation. Thanks again
It is quite common to "get stuck in the idea". Sometimes it helps to explain a bigger picture to someone else, and the other person may come up with a better idea of how this can be done [which is why I often ask for "what's the big picture" in threads where someone is asking "How do I ..."].
Generally discussing ideas for solutions help, of course.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
It's wonderful to explain the bigger picture to someone.
"So I need to make the ball hop down the hall and therefore I need to ... need to ... what am I doing this nonsense for?"
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
The nice thing that it works even with non-programmers. I habitually explain my problems to my father, who can barely follow me. Still helps.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law