Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 12, 2009, 5:13:34 PM (16 years ago)
Author:
dafrick
Message:

Updated questsystem to current trunk. Synchronized it with my local state of things. The Notifications are not yet working, though.

File:
1 edited

Legend:

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

    r2662 r2779  
    2727 */
    2828
     29/**
     30    @file NotificationManager.h
     31    @brief Definition of the NotificationManager class.
     32*/
     33
    2934#ifndef _NotificationManager_H__
    3035#define _NotificationManager_H__
     
    3439#include "core/BaseObject.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 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
     
    5357    class _OrxonoxExport NotificationManager : public BaseObject
    5458    {
    55    
    56     public:
    57         NotificationManager(BaseObject* creator);
    58         virtual ~NotificationManager();
     59        public:
     60            NotificationManager(BaseObject* creator);
     61            virtual ~NotificationManager();
     62               
     63            static const std::string ALL;
     64            static const std::string NONE;
     65         
     66            //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.
     69           
     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.
     71           
     72            /**
     73            @brief Fetches the Notifications for a specific NotificationQueue starting at a specified time.
     74            @param queue The NotificationQueue the Notifications are fetched for.
     75            @param timeFrameStart The start time the Notifications are fetched from.
     76            @return Returns a time-ordered list of Notifications.
     77            */
     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)); }
     80            /**
     81            @brief Fetches the Notifications for a specific NotificationQueue starting at a specified timespan before now.
     82            @param queue The NotificationQueue the Notifications are fetched for.
     83            @param timeDelay The timespan.
     84            @return Returns a time-ordered list of Notifications.
     85            */
     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)); }
     88     
     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.
    5991       
    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);
     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.
     95           
    6996
    7097    };
Note: See TracChangeset for help on using the changeset viewer.