isChanged = true;
for (auto it = observers.begin(); it != observers.end(); ++it)
- (*it)->update(ruleName);
+ (*it)->update(reinterpret_cast<int*>(this));
}
void Action::valueChangedCallback(void *userData)
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<Action*>(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;
}
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<std::string, Mode> savedModes;
- std::multimap<std::string, std::string> essentialMap;
+ std::multimap<Action*, std::string> essentialMap;
std::string undoDir;
};