Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2009, 11:41:25 AM (15 years ago)
Author:
dafrick
Message:

Made QuestManager and NotificationManager to Singletons. Fixed/Changed som other stuff I don't remember…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5/src/orxonox/overlays/notifications/NotificationManager.h

    r2779 r2785  
    5050    /**
    5151    @brief
    52         The NotificationManager functions as a gateway between Notifications and NotificationQueues.
     52        The Singleton NotificationManager functions as a gateway between Notifications and NotificationQueues.
    5353        It receives, organizes Notifications and the redistributes them to the specific NotificationQueues.
    5454    @author
     
    5757    class _OrxonoxExport NotificationManager : public BaseObject
    5858    {
     59        protected:
     60            NotificationManager();
     61
    5962        public:
    60             NotificationManager(BaseObject* creator);
    6163            virtual ~NotificationManager();
    6264               
     
    6466            static const std::string NONE;
    6567         
     68            static NotificationManager & getInstance(); //! Returns a reference to the single instance of the NotificationManager.
     69
    6670            //TDO: Visibility?
    67             static bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
    68             static bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue within the NotificationManager.
     71            bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
     72            bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue within the NotificationManager.
    6973           
    70             static std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationQueue in a specified timeframe.
     74            std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationQueue in a specified timeframe.
    7175           
    7276            /**
     
    7680            @return Returns a time-ordered list of Notifications.
    7781            */
    78             static std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart)
    79                 { return NotificationManager::getNotifications(queue, timeFrameStart, std::time(0)); }
     82            std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, const std::time_t & timeFrameStart)
     83                { return this->getNotifications(queue, timeFrameStart, std::time(0)); }
    8084            /**
    8185            @brief Fetches the Notifications for a specific NotificationQueue starting at a specified timespan before now.
     
    8488            @return Returns a time-ordered list of Notifications.
    8589            */
    86             static std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, int timeDelay)
    87                 { return NotificationManager::getNotifications(queue, std::time(0)-timeDelay, std::time(0)); }
     90            std::multimap<std::time_t,Notification*>* getNotifications(NotificationQueue* queue, int timeDelay)
     91                { return this->getNotifications(queue, std::time(0)-timeDelay, std::time(0)); }
    8892     
    89                private:
    90             static int highestIndex_s; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that  no key appears twice.
     93        private:
     94            static NotificationManager* singletonRef_s;
     95
     96            int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that  no key appears twice.
    9197       
    92             static std::multimap<std::time_t,Notification*> allNotificationsList_s; //!< Container where all notifications are stored (together with their respecive timestamps).
    93             static std::map<NotificationQueue*,int> queueList_s; //!< Container where all NotificationQueues are stored with a number as identifier.
    94             static std::map<int,std::multimap<std::time_t,Notification*>*> notificationLists_s; //!< Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored.
     98            std::multimap<std::time_t,Notification*> allNotificationsList_; //!< Container where all notifications are stored (together with their respecive timestamps).
     99            std::map<NotificationQueue*,int> queueList_; //!< Container where all NotificationQueues are stored with a number as identifier.
     100            std::map<int,std::multimap<std::time_t,Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored.
    95101           
    96102
Note: See TracChangeset for help on using the changeset viewer.