Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2009, 1:07:27 AM (15 years ago)
Author:
dafrick
Message:

Merging the QuestSystem branch to the trunk. Let's hope, this isn't a 'third time's the charm'-thing…

File:
1 edited

Legend:

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

    r2662 r2909  
    2727 */
    2828
     29/**
     30    @file NotificationManager.h
     31    @brief Definition of the NotificationManager class.
     32*/
     33
    2934#ifndef _NotificationManager_H__
    3035#define _NotificationManager_H__
     
    3237#include "OrxonoxPrereqs.h"
    3338
    34 #include "core/BaseObject.h"
     39#include "core/OrxonoxClass.h"
    3540
    36 #include <list>
     41#include <map>
    3742#include <string>
     43#include <ctime>
     44
     45#include "NotificationOverlay.h"
    3846
    3947namespace orxonox
    4048{
    41     struct NotificationContainer
    42     {
    43         Notification* notification;
    44         float remainingTime;
    45     };
    4649
    4750    /**
    4851    @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.
    5054    @author
    5155        Damian 'Mozork' Frick
    5256    */
    53     class _OrxonoxExport NotificationManager : public BaseObject
     57    class _OrxonoxExport NotificationManager : public OrxonoxClass
    5458    {
    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.
    5996       
    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           
    69101
    70102    };
Note: See TracChangeset for help on using the changeset viewer.