Changeset 7413 for code/trunk/src
- Timestamp:
- Sep 11, 2010, 5:05:47 PM (14 years ago)
- Location:
- code/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/util/StringUtils.h
r7401 r7413 47 47 { 48 48 extern _UtilExport std::string BLANKSTRING; 49 50 //!< Struct that can be used as a comparison object for strings in stl containers. 51 _UtilExport struct StringCompare 52 { 53 bool operator() (const std::string& lhs, const std::string& rhs) const 54 { return lhs.compare(rhs) < 0; } 55 }; 56 49 57 _UtilExport std::string getUniqueNumberString(); 50 58 -
code/trunk/src/modules/notifications/Notification.cc
r7410 r7413 104 104 @brief 105 105 Sends the Notification to the Notificationmanager, which then in turn distributes it to the different NotificationQueues. 106 @param clientI D106 @param clientId 107 107 The id of the client that this Notification is sent to. 108 108 @param sender -
code/trunk/src/modules/notifications/NotificationManager.cc
r7403 r7413 129 129 for(std::map<NotificationListener*, unsigned int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) // Iterate through all NotificationListeners. 130 130 { 131 std::set<std::string, NotificationListenerStringCompare> set = it->first->getTargetsSet();131 std::set<std::string, StringCompare> set = it->first->getTargetsSet(); 132 132 bool bAll = set.find(NotificationManager::ALL) != set.end(); 133 133 // If either the Notification has as sender 'all', the NotificationListener displays all Notifications or the NotificationListener has the sender of the Notification as target. … … 210 210 this->listenerList_[listener] = index; // Add the NotificationListener to the list of NotificationListeners. 211 211 212 std::set<std::string, NotificationListenerStringCompare> set = listener->getTargetsSet();212 std::set<std::string, StringCompare> set = listener->getTargetsSet(); 213 213 214 214 // If all senders are the target of the NotificationListener, then the list of Notifications for that specific NotificationListener is the same as the list of all Notifications. … … 248 248 assert(listener); 249 249 250 //TODO: Make unsigned int.251 250 unsigned int identifier = this->listenerList_.find(listener)->second; 252 251 std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second; -
code/trunk/src/modules/notifications/NotificationQueue.cc
r7412 r7413 69 69 // Initialize. 70 70 this->size_ = 0; 71 this->tickTime_ = 0.0 ;71 this->tickTime_ = 0.0f; 72 72 73 73 // Sets the input values. … … 77 77 this->setDisplayTime(displayTime); 78 78 79 //TODO: Destroy if registration fails?80 81 79 // Register the NotificationQueue with the NotificationManager. 82 80 bool queueRegistered = NotificationManager::getInstance().registerQueue(this); … … 85 83 { 86 84 this->registered_ = false; 87 COUT(1) << "Error: Notification 85 COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl; 88 86 return; 89 87 } … … 99 97 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() + "\")"); 100 98 NotificationManager::getInstance().unregisterQueue(this); 101 COUT(1) << "Error: Notification 99 COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl; 102 100 return; 103 101 } … … 358 356 bool first = true; 359 357 // Iterate through the set of targets. 360 for(std::set<std::string, NotificationListenerStringCompare>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)358 for(std::set<std::string, StringCompare>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++) 361 359 { 362 360 if(!first) -
code/trunk/src/modules/notifications/NotificationQueue.h
r7412 r7413 124 124 @return Returns a set of strings holding the different targets. 125 125 */ 126 inline const std::set<std::string, NotificationListenerStringCompare> & getTargetsSet()126 inline const std::set<std::string, StringCompare> & getTargetsSet() 127 127 { return this->targets_; } 128 128 … … 144 144 bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already. 145 145 146 std::set<std::string, NotificationListenerStringCompare> targets_; //!< The targets the NotificationQueue displays Notifications of.146 std::set<std::string, StringCompare> targets_; //!< The targets the NotificationQueue displays Notifications of. 147 147 148 148 std::multiset<NotificationContainer*, NotificationContainerCompare> ordering_; //!< The NotificationContainers ordered by the time they were registered. -
code/trunk/src/orxonox/interfaces/NotificationListener.h
r7403 r7413 41 41 #include <string> 42 42 43 #include "util/StringUtils.h" 44 43 45 #include "core/OrxonoxClass.h" 44 46 … … 46 48 { 47 49 class Notification; 48 49 /**50 @brief51 Struct that overloads the compare operation between two PickupIdentifier pointers.52 */53 //TODO:54 struct NotificationListenerStringCompare55 {56 bool operator() (const std::string& lhs, const std::string& rhs) const57 { return lhs.compare(rhs) < 0; }58 };59 50 60 51 /** … … 70 61 virtual ~NotificationListener() {} 71 62 72 virtual const std::set<std::string, NotificationListenerStringCompare> & getTargetsSet() = 0;63 virtual const std::set<std::string, StringCompare> & getTargetsSet() = 0; 73 64 virtual void update(void) = 0; 74 65 virtual void update(Notification* notification, const std::time_t & time) = 0;
Note: See TracChangeset
for help on using the changeset viewer.