Changeset 2065 for code/branches/objecthierarchy/src/core/BaseObject.cc
- Timestamp:
- Oct 30, 2008, 2:44:48 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/core/BaseObject.cc
r2063 r2065 35 35 #include "tinyxml/tinyxml.h" 36 36 #include "CoreIncludes.h" 37 #include "EventIncludes.h" 37 38 #include "XMLPort.h" 38 39 #include "XMLFile.h" … … 79 80 BaseObject::~BaseObject() 80 81 { 82 for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it) 83 (*it)->eventListeners_.erase(this); 81 84 } 82 85 … … 184 187 void BaseObject::addEvent(BaseObject* event, const std::string& sectionname) 185 188 { 186 this->eventListeners_.insert(std::pair<std::string, BaseObject*>(sectionname, event)); 189 event->eventListeners_[this] = sectionname; 190 this->events_.push_back(event); 187 191 } 188 192 … … 190 194 { 191 195 unsigned int i = 0; 192 for (std:: set<std::pair<std::string, BaseObject*> >::const_iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)196 for (std::list<BaseObject*>::const_iterator it = this->events_.begin(); it != this->events_.end(); ++it) 193 197 { 194 198 if (i == index) 195 return (*it) .second;199 return (*it); 196 200 ++i; 197 201 } … … 230 234 Event event(activate, this); 231 235 232 for (std:: set<std::pair<std::string, BaseObject*>>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it)233 { 234 event.sectionname_ = (*it).first;235 (*it).second->processEvent(event);236 for (std::map<BaseObject*, std::string>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it) 237 { 238 event.sectionname_ = it->second; 239 it->first->processEvent(event); 236 240 } 237 241 }
Note: See TracChangeset
for help on using the changeset viewer.