- Timestamp:
- Sep 11, 2010, 10:20:44 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/notifications (added) merged: 7319,7324,7326,7338-7343,7348-7349,7351,7354-7355,7358-7360,7362,7395,7398-7400
- Property svn:mergeinfo changed
-
code/trunk/src/modules/notifications/NotificationManager.h
r7164 r7403 28 28 29 29 /** 30 @file 30 @file NotificationManager.h 31 31 @brief Definition of the NotificationManager class. 32 32 */ … … 44 44 #include "core/OrxonoxClass.h" 45 45 46 namespace orxonox 47 { 46 namespace orxonox // tolua_export 47 { // tolua_export 48 48 49 /** 49 50 @brief … … 53 54 Damian 'Mozork' Frick 54 55 */ 55 class _NotificationsExport NotificationManager : public Singleton<NotificationManager>, public OrxonoxClass 56 { 56 class _NotificationsExport NotificationManager // tolua_export 57 : public Singleton<NotificationManager>, public OrxonoxClass 58 { // tolua_export 57 59 friend class Singleton<NotificationManager>; 58 60 public: … … 60 62 virtual ~NotificationManager(); 61 63 64 virtual void preDestroy(void); //!< Is called before the object is destroyed. 65 66 static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export 67 62 68 static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners. 63 69 static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener. 64 70 65 71 bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager. 66 void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager .72 void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager for a given NotificationListener. 67 73 bool registerListener(NotificationListener* listener); //!< Registers a NotificationListener within the NotificationManager. 68 74 void unregisterListener(NotificationListener* listener); //!< Unregisters a NotificationListener withing the NotificationManager. 69 75 70 bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationListener in a specified timeframe.76 void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Fetches the Notifications for a specific NotificationListener in a specified timeframe and stores them in the input map. 71 77 72 78 /** 73 @brief Fetches the Notifications for a specific NotificationListener starting at a specified time.79 @brief Fetches the Notifications for a specific NotificationListener in a timeframe from now-timeDelay to now and stores them in the input map. 74 80 @param listener The NotificationListener the Notifications are fetched for. 75 @param map A multimap, in which the notifications are stored. 76 @param timeFrameStart The start time the Notifications are fetched from. 77 @return Returns true if successful. 78 */ 79 bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart) 80 { return this->getNotifications(listener, map, timeFrameStart, std::time(0)); } 81 /** 82 @brief Fetches the Notifications for a specific NotificationListener starting at a specified timespan before now. 83 @param listener The NotificationListener the Notifications are fetched for. 84 @param map A multimap, in which the notifications are stored. 81 @param map A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated. 85 82 @param timeDelay The timespan. 86 83 @return Returns true if successful. 87 84 */ 88 bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, int timeDelay) 89 { return this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); } 85 void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int timeDelay) 86 { this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); } 87 88 void enterEditMode(void); //!< Enters the edit mode of the NotificationLayer. 89 90 bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue. 91 void unregisterQueue(NotificationQueue* queue); //!< Unregisters a NotificationQueue. 92 93 // tolua_begin 94 void loadQueues(void); //!< Loads all the NotificationQueues that should exist. 95 void createQueue(const std::string& name); //!< Creates a new NotificationQueue. 96 orxonox::NotificationQueue* getQueue(const std::string & name); //!< Get the NotificationQueue with the input name. 97 // tolua_end 90 98 91 99 private: 92 100 static NotificationManager* singletonPtr_s; 93 101 94 int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.102 unsigned int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice. 95 103 96 std::multimap<std::time_t,Notification*> allNotificationsList_; //!< Container where all notifications are stored. 97 std::map<NotificationListener*,int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier. 98 std::map<int,std::multimap<std::time_t,Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored. 99 std::map<Notification*, unsigned int> listenerCounter_; //!< A container to store the number of NotificationListeners a Notification is registered with. 104 std::multimap<std::time_t, Notification*> allNotificationsList_; //!< Container where all Notifications are stored. 105 std::map<NotificationListener*, unsigned int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier. 106 std::map<int,std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored. 100 107 101 bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input notification form an input map.108 std::map<const std::string, NotificationQueue*> queues_; //!< The list of NotificationQueues created by the NotificationManager. 102 109 103 };110 bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input Notification form an input map. 104 111 105 } 112 }; // tolua_export 113 114 } // tolua_export 106 115 107 116 #endif /* _NotificationManager_H__ */
Note: See TracChangeset
for help on using the changeset viewer.