- Timestamp:
- May 2, 2011, 10:20:45 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.h
r8371 r8374 43 43 44 44 #include "util/Singleton.h" 45 #include " core/OrxonoxClass.h"45 #include "interfaces/NotificationListener.h" 46 46 47 47 namespace orxonox // tolua_export … … 60 60 */ 61 61 class _NotificationsExport NotificationManager // tolua_export 62 : public Singleton<NotificationManager>, public OrxonoxClass62 : public Singleton<NotificationManager>, public NotificationListener 63 63 { // tolua_export 64 64 friend class Singleton<NotificationManager>; … … 75 75 static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export 76 76 77 static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners. 78 static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener. 79 80 //! Sends a Notification with the specified message to the specified client from the specified sender. 81 static void sendNotification(const std::string& message, unsigned int clientId, const std::string& sender = NotificationManager::NONE, bool isLocal = false); 77 virtual bool registerNotification(const std::string& message, const std::string& sender); 82 78 83 79 bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager. 84 void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager for a given NotificationListener. 85 bool registerListener(NotificationListener* listener); //!< Registers a NotificationListener within the NotificationManager. 86 void unregisterListener(NotificationListener* listener); //!< Unregisters a NotificationListener withing the NotificationManager. 80 void unregisterNotification(Notification* notification, NotificationQueue* queue); //!< Unregisters a Notification within the NotificationManager for a given NotificationQueue. 87 81 88 void getNotifications(Notification Listener* listener, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Fetches the Notifications for a specific NotificationListenerin a specified timeframe and stores them in the input map.82 void getNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Fetches the Notifications for a specific NotificationQueue in a specified timeframe and stores them in the input map. 89 83 90 84 /** 91 @brief Fetches the Notifications for a specific Notification Listenerin a timeframe from now-timeDelay to now and stores them in the input map.92 @param listener The Notification Listenerthe Notifications are fetched for.85 @brief Fetches the Notifications for a specific NotificationQueue in a timeframe from now-timeDelay to now and stores them in the input map. 86 @param listener The NotificationQueue the Notifications are fetched for. 93 87 @param map A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated. 94 88 @param timeDelay The timespan. 95 89 @return Returns true if successful. 96 90 */ 97 void getNotifications(Notification Listener* listener, std::multimap<std::time_t, Notification*>* map, int timeDelay)98 { this->getNotifications( listener, map, std::time(0)-timeDelay, std::time(0)); }91 void getNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, int timeDelay) 92 { this->getNotifications(queue, map, std::time(0)-timeDelay, std::time(0)); } 99 93 100 void getNewestNotifications(Notification Listener* listener, std::multimap<std::time_t, Notification*>* map, int numberOfNotifications); //!< Fetches the newest Notifications for a specific NotificationListenerand stores them in the input map.94 void getNewestNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, int numberOfNotifications); //!< Fetches the newest Notifications for a specific NotificationQueue and stores them in the input map. 101 95 102 96 void enterEditMode(void); //!< Enters the edit mode of the NotificationLayer. … … 114 108 static NotificationManager* singletonPtr_s; 115 109 116 unsigned int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.117 118 110 std::multimap<std::time_t, Notification*> allNotificationsList_; //!< Container where all Notifications are stored. 119 std::map<NotificationListener*, unsigned int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier. 120 std::map<int,std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored. 111 std::map<const std::string, std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored. 121 112 122 113 std::map<const std::string, NotificationQueue*> queues_; //!< The list of NotificationQueues created by the NotificationManager.
Note: See TracChangeset
for help on using the changeset viewer.