123456789101112131415161718192021222324252627282930 |
- #include "RUMsgSubscriber.h"
- #include "RUMsgCenter.h"
- NS_RU_BEGIN
- void MsgSubscriber::subscribe(std::string key4MsgCenter, kMsgTopic msgTopic, int priority)
- {
- gMsgCenter(key4MsgCenter)->addSubscriber(msgTopic, this, priority);
- }
- void MsgSubscriber::unsubscribe(std::string key4MsgCenter, kMsgTopic msgTopic)
- {
- gMsgCenter(key4MsgCenter)->removeSubscriber(msgTopic, this);
- }
- void MsgSubscriber::setPriority(kMsgTopic msgTopic, int priority)
- {
- int msgTopicId = (int)msgTopic;
- _priorityMap.emplace(msgTopicId,priority);
- }
- int MsgSubscriber::getPriority(kMsgTopic msgTopic)
- {
- int priority = 0;
- int msgTopicId = (int)msgTopic;
- priority = _priorityMap[msgTopicId];
- return priority;
- }
- NS_RU_END
|