I need help in implementing a design:
I have MessageID's(integer Macros) declared in project. Each MID is associated one or more sources(enum 0 -19). By checking each source of MID, I want to call different functions. My followed following approach:
typedef std::pair<int,unsigned int *> MIDPair;
- this binds MID(int) with sources(array of int)
typedef std::map<MIDPair,fpPtr> mapRSE;
- carries MIDpair with funtion pointer
Initially I am creating different pairs(mid's and array having applicable sources) and pushing them in map with applicable function pointers. I when i receive any MID i will check the current source and call corresponding function.
please let me know if my approach is correct on the cotainers selected/ or suggest me any other approach