Changeset 10821 for code/branches/cpp11_v2/src/modules/notifications
- Timestamp:
- Nov 21, 2015, 7:05:53 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/modules/notifications
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/notifications/NotificationManager.cc
r10765 r10821 69 69 { 70 70 // Destroys all Notifications. 71 for( std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it!= this->allNotificationsList_.end(); it++)72 it->second->destroy();71 for(auto & elem : this->allNotificationsList_) 72 elem.second->destroy(); 73 73 this->allNotificationsList_.clear(); 74 74 … … 152 152 bool executed = false; 153 153 // Clear all NotificationQueues that have the input sender as target. 154 for( std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.155 { 156 const std::set<std::string>& set = it->second->getTargetsSet();154 for(auto & elem : this->queues_) // Iterate through all NotificationQueues. 155 { 156 const std::set<std::string>& set = elem.second->getTargetsSet(); 157 157 // If either the sender is 'all', the NotificationQueue has as target all or the NotificationQueue has the input sender as a target. 158 158 if(all || set.find(NotificationListener::ALL) != set.end() || set.find(sender) != set.end()) 159 executed = it->second->tidy() || executed;159 executed = elem.second->tidy() || executed; 160 160 } 161 161 … … 187 187 188 188 // Insert the Notification in all NotificationQueues that have its sender as target. 189 for( std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.190 { 191 const std::set<std::string>& set = it->second->getTargetsSet();189 for(auto & elem : this->queues_) // Iterate through all NotificationQueues. 190 { 191 const std::set<std::string>& set = elem.second->getTargetsSet(); 192 192 bool bAll = set.find(NotificationListener::ALL) != set.end(); 193 193 // If either the Notification has as sender 'all', the NotificationQueue displays all Notifications or the NotificationQueue has the sender of the Notification as target. … … 195 195 { 196 196 if(!bAll) 197 this->notificationLists_[ it->second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue.198 it->second->update(notification, time); // Update the NotificationQueue.197 this->notificationLists_[elem.second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue. 198 elem.second->update(notification, time); // Update the NotificationQueue. 199 199 } 200 200 } … … 345 345 346 346 // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationQueue. 347 for( std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)348 { 349 if(!bAll && set.find( it->second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.350 map->insert(std::pair<std::time_t, Notification*>( it->first, it->second));347 for(auto & elem : this->allNotificationsList_) 348 { 349 if(!bAll && set.find(elem.second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target. 350 map->insert(std::pair<std::time_t, Notification*>(elem.first, elem.second)); 351 351 } 352 352 -
code/branches/cpp11_v2/src/modules/notifications/NotificationQueue.cc
r9667 r10821 206 206 { 207 207 // Add all Notifications that have been created after this NotificationQueue was created. 208 for( std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)208 for(auto & notification : *notifications) 209 209 { 210 if( it->first >= this->creationTime_)211 this->push( it->second, it->first);210 if(notification.first >= this->creationTime_) 211 this->push(notification.second, notification.first); 212 212 } 213 213 } … … 336 336 this->ordering_.clear(); 337 337 // Delete all NotificationContainers in the list. 338 for( std::vector<NotificationContainer*>::iterator it = this->notifications_.begin(); it != this->notifications_.end(); it++)339 delete *it;338 for(auto & elem : this->notifications_) 339 delete elem; 340 340 341 341 this->notifications_.clear(); … … 426 426 bool first = true; 427 427 // Iterate through the set of targets. 428 for( std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)428 for(const auto & elem : this->targets_) 429 429 { 430 430 if(!first) … … 432 432 else 433 433 first = false; 434 stream << *it;434 stream << elem; 435 435 } 436 436
Note: See TracChangeset
for help on using the changeset viewer.