- Timestamp:
- Apr 8, 2009, 1:07:27 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/overlays/notifications/NotificationManager.h
r2662 r2909 27 27 */ 28 28 29 /** 30 @file NotificationManager.h 31 @brief Definition of the NotificationManager class. 32 */ 33 29 34 #ifndef _NotificationManager_H__ 30 35 #define _NotificationManager_H__ … … 32 37 #include "OrxonoxPrereqs.h" 33 38 34 #include "core/ BaseObject.h"39 #include "core/OrxonoxClass.h" 35 40 36 #include < list>41 #include <map> 37 42 #include <string> 43 #include <ctime> 44 45 #include "NotificationOverlay.h" 38 46 39 47 namespace orxonox 40 48 { 41 struct NotificationContainer42 {43 Notification* notification;44 float remainingTime;45 };46 49 47 50 /** 48 51 @brief 49 52 The Singleton NotificationManager functions as a gateway between Notifications and NotificationQueues. 53 It receives, organizes Notifications and the redistributes them to the specific NotificationQueues. 50 54 @author 51 55 Damian 'Mozork' Frick 52 56 */ 53 class _OrxonoxExport NotificationManager : public BaseObject57 class _OrxonoxExport NotificationManager : public OrxonoxClass 54 58 { 55 56 public: 57 NotificationManager(BaseObject* creator); 58 virtual ~NotificationManager(); 59 public: 60 NotificationManager(); 61 virtual ~NotificationManager(); 62 63 static const std::string ALL; 64 static const std::string NONE; 65 66 static NotificationManager & getInstance(); //! Returns a reference to the single instance of the NotificationManager. 67 68 bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager. 69 bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue within the NotificationManager. 70 71 bool getNotifications(NotificationQueue* queue, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationQueue in a specified timeframe. 72 73 /** 74 @brief Fetches the Notifications for a specific NotificationQueue starting at a specified time. 75 @param queue The NotificationQueue the Notifications are fetched for. 76 @param map A multimap, in which the notifications are stored. 77 @param timeFrameStart The start time the Notifications are fetched from. 78 @return Returns true if successful. 79 */ 80 bool getNotifications(NotificationQueue* queue, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart) 81 { return this->getNotifications(queue, map, timeFrameStart, std::time(0)); } 82 /** 83 @brief Fetches the Notifications for a specific NotificationQueue starting at a specified timespan before now. 84 @param queue The NotificationQueue the Notifications are fetched for. 85 @param map A multimap, in which the notifications are stored. 86 @param timeDelay The timespan. 87 @return Returns true if successful. 88 */ 89 bool getNotifications(NotificationQueue* queue, std::multimap<std::time_t,Notification*>* map, int timeDelay) 90 { return this->getNotifications(queue, map, std::time(0)-timeDelay, std::time(0)); } 91 92 private: 93 static NotificationManager* singletonRef_s; 94 95 int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice. 59 96 60 static bool insertNotification(Notification* notification); 61 62 static void tick(float dt); 63 64 private: 65 static std::list<NotificationContainer*> notifications_s; 66 67 static void updateQueue(void); 68 static const std::string clipMessage(const std::string & message); 97 std::multimap<std::time_t,Notification*> allNotificationsList_; //!< Container where all notifications are stored (together with their respecive timestamps). 98 std::map<NotificationQueue*,int> queueList_; //!< Container where all NotificationQueues are stored with a number as identifier. 99 std::map<int,std::multimap<std::time_t,Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored. 100 69 101 70 102 };
Note: See TracChangeset
for help on using the changeset viewer.