From: Youngjae Shin Date: Tue, 25 Feb 2020 06:24:12 +0000 (+0900) Subject: revise essential map X-Git-Tag: submit/tizen/20200319.043412~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f5e9022906d81e3c38a5c62f217abb4d1341ec8;p=platform%2Fcore%2Fsystem%2Fmodes.git revise essential map --- diff --git a/supervisor/Action.cpp b/supervisor/Action.cpp index c6224bc..66003f6 100644 --- a/supervisor/Action.cpp +++ b/supervisor/Action.cpp @@ -133,7 +133,7 @@ void Action::notifyObservers() isChanged = true; for (auto it = observers.begin(); it != observers.end(); ++it) - (*it)->update(ruleName); + (*it)->update(reinterpret_cast(this)); } void Action::valueChangedCallback(void *userData) diff --git a/supervisor/ActionObserver.h b/supervisor/ActionObserver.h index 2e2a3d5..bb1681e 100644 --- a/supervisor/ActionObserver.h +++ b/supervisor/ActionObserver.h @@ -22,7 +22,7 @@ MODES_NAMESPACE_BEGIN class ActionObserver { public: - virtual void update(const std::string &rule) = 0; + virtual void update(int *key) = 0; }; MODES_NAMESPACE_END diff --git a/supervisor/ModeCareTaker.cpp b/supervisor/ModeCareTaker.cpp index c362511..f8343af 100644 --- a/supervisor/ModeCareTaker.cpp +++ b/supervisor/ModeCareTaker.cpp @@ -121,17 +121,18 @@ void ModeCareTaker::handleEssentialAction(const Mode &mode) for (auto it = actionList.begin(); it != actionList.end(); it++) { if ((*it)->getRestrict() == Action::ESSENTIAL) { DBG("Essential Action(%s)", (*it)->getRuleName().c_str()); - essentialMap.insert(std::make_pair((*it)->getRuleName(), mode.getName())); + essentialMap.insert(std::make_pair((*it).get(), mode.getName())); (*it)->attachObserver(this); } } } -void ModeCareTaker::update(const std::string &rule) +void ModeCareTaker::update(int *key) { - auto found = essentialMap.find(rule); + Action *action = reinterpret_cast(key); + auto found = essentialMap.find(action); if (essentialMap.end() == found) { - ERR("No Mode related with essential rule(%s)", rule.c_str()); + ERR("No Mode related with essential rule(%s)", action->getRuleName().c_str()); return; } diff --git a/supervisor/ModeCareTaker.h b/supervisor/ModeCareTaker.h index 7803dbf..50d975b 100644 --- a/supervisor/ModeCareTaker.h +++ b/supervisor/ModeCareTaker.h @@ -34,12 +34,12 @@ public: int popMode(const std::string &name, Mode &mode); bool isSavedMode(const std::string &name); bool checkConflictAction(const Mode &mode); - void update(const std::string &rule); + void update(int *key); private: void handleEssentialAction(const Mode &mode); bool findLockedAction(const std::string &ruleName); std::map savedModes; - std::multimap essentialMap; + std::multimap essentialMap; std::string undoDir; };