27 using namespace YACS::ENGINE;
35 DEBTRACE(
"notifyObserver " << event <<
object );
40 DEBTRACE(
"notifyObserver2 " << event <<
object );
66 std::cerr <<
"Dispatcher::printObservers " << std::endl;
67 typedef std::map< std::pair<Node*,std::string> , std::set<Observer*> >::iterator it;
68 typedef std::set<Observer*>::iterator jt;
72 std::cerr <<
"Node*: " << (*i).first.first <<
" event: " << (*i).first.second << std::endl;
73 for(jt j=(*i).second.begin();j!=(*i).second.end();j++)
75 std::cerr <<
"observer: " << *j << std::endl;
82 DEBTRACE(
"Dispatcher::dispatch " << event );
83 std::pair<Node*,std::string> key(
object,event);
84 std::map< std::pair<Node*,std::string> , std::set<Observer*> >::const_iterator it(
_observers.find(key));
87 for(std::set<Observer*>::const_iterator iter=(*it).second.begin();iter!=(*it).second.end();iter++)
89 (*iter)->notifyObserver(
object,event);
96 std::pair<Node*,std::string> key(
object,event);
97 std::map< std::pair<Node*,std::string> , std::set<Observer*> >::const_iterator it(
_observers.find(key));
100 for(std::set<Observer*>::const_iterator iter=(*it).second.begin();iter!=(*it).second.end();iter++)
102 (*iter)->notifyObserver2(
object,event,something);
109 _observers[std::pair<Node*,std::string>(object,event)].insert(observer);
115 _observers[std::pair<Node*,std::string>(object,event)].erase(observer);