Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 10, 2010, 11:17:02 PM (14 years ago)
Author:
dafrick
Message:

Some cleanup and documenting.
After some more extensive testing it seems to work, the code looks ok as well…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/notifications/src/modules/notifications/NotificationManager.h

    r7395 r7399  
    6262            virtual ~NotificationManager();
    6363
    64             virtual void preDestroy(void);
     64            virtual void preDestroy(void); //!< Is called before the object is destroyed.
    6565
    6666            static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export
     
    7070
    7171            bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
    72             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.
    7373            bool registerListener(NotificationListener* listener); //!< Registers a NotificationListener within the NotificationManager.
    7474            void unregisterListener(NotificationListener* listener); //!< Unregisters a NotificationListener withing the NotificationManager.
    7575
    76             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.
    7777
    7878            /**
    79             @brief Fetches the Notifications for a specific NotificationListener starting at a specified timespan before now.
     79            @brief Fetches the Notifications for a specific NotificationListener in a timeframe from now-timeDelay to now and stores them in the input map.
    8080            @param listener The NotificationListener the Notifications are fetched for.
    81             @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.
    8282            @param timeDelay The timespan.
    8383            @return Returns true if successful.
    8484            */
    85             bool getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int timeDelay)
    86                 { 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)); }
    8787
    88             void enterEditMode(void);
     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.
    8992
    9093            // tolua_begin
    91             void loadQueues(void);
    92            
    93             void createQueue(const std::string& name);
    94             orxonox::NotificationQueue* getQueue(const std::string & name);
     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.
    9597            // tolua_end
    96 
    97             bool registerQueue(NotificationQueue* queue);
    98             void unregisterQueue(NotificationQueue* queue);
    9998
    10099        private:
    101100            static NotificationManager* singletonPtr_s;
    102101
     102            unsigned int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
     103
     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.
     107
    103108            std::map<const std::string, NotificationQueue*> queues_; //!< The list of NotificationQueues created by the NotificationManager.
    104109
    105             int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
    106 
    107             std::multimap<std::time_t, Notification*> allNotificationsList_; //!< Container where all notifications are stored.
    108             std::map<NotificationListener*, int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier.
    109             std::map<int,std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored.
    110             std::map<Notification*, unsigned int> listenerCounter_; //!< A container to store the number of NotificationListeners a Notification is registered with.
    111 
    112             bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input notification form an input map.
     110            bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input Notification form an input map.
    113111
    114112    }; // tolua_export
Note: See TracChangeset for help on using the changeset viewer.