Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 10, 2011, 11:37:22 PM (13 years ago)
Author:
dafrick
Message:

NotificationListener is new an entity which is informed of new notifications. The NotificationManager is, so far, the only NotificationListener. This means that Notifications can now be sent from within orxonox (though not libraries or external).
Also introduced notification commands to affect the NotificationQueues in more ways than just have them display messages (e.g. clearing them).
Added a message type which allows to send Notifications of different importance, allowing the NotificationQueus to display them differently.

File:
1 edited

Legend:

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

    r8374 r8445  
    6767            virtual ~NotificationManager();
    6868
    69             virtual void preDestroy(void); //!< Is called before the object is destroyed.
     69            virtual void preDestroy(void); // Is called before the object is destroyed.
    7070
    7171            /**
     
    7575            static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export
    7676
    77             virtual bool registerNotification(const std::string& message, const std::string& sender);
     77            virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type);
     78            virtual bool executeCommand(notificationCommand::Value command, const std::string& sender);
    7879
    79             bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
    80             void unregisterNotification(Notification* notification, NotificationQueue* queue); //!< Unregisters a Notification within the NotificationManager for a given NotificationQueue.
     80            bool registerNotification(Notification* notification); // Registers a Notification within the NotificationManager.
     81            void unregisterNotification(Notification* notification, NotificationQueue* queue); // Unregisters a Notification within the NotificationManager for a given NotificationQueue.
    8182
    82             void getNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Fetches the Notifications for a specific NotificationQueue in a specified timeframe and stores them in the input map.
     83            void getNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); // Fetches the Notifications for a specific NotificationQueue in a specified timeframe and stores them in the input map.
    8384
    8485            /**
    85             @brief Fetches the Notifications for a specific NotificationQueue in a timeframe from now-timeDelay to now and stores them in the input map.
    86             @param listener The NotificationQueue the Notifications are fetched for.
     86            @brief Fetches the Notifications for a specific NotificationQueue in a timeframe from (now-timeDelay) to now and stores them in the input map.
     87            @param queue The NotificationQueue the Notifications are fetched for.
    8788            @param map A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
    8889            @param timeDelay The timespan.
     
    9293                { this->getNotifications(queue, map, std::time(0)-timeDelay, std::time(0)); }
    9394
    94             void getNewestNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, int numberOfNotifications); //!< Fetches the newest Notifications for a specific NotificationQueue and stores them in the input map.
     95            void getNewestNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, int numberOfNotifications); // Fetches the newest Notifications for a specific NotificationQueue and stores them in the input map.
    9596
    96             void enterEditMode(void); //!< Enters the edit mode of the NotificationLayer.
     97            void enterEditMode(void); // Enters the edit mode of the NotificationLayer.
    9798
    98             bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue.
    99             void unregisterQueue(NotificationQueue* queue); //!< Unregisters a NotificationQueue.
     99            bool registerQueue(NotificationQueue* queue); // Registers a NotificationQueue.
     100            void unregisterQueue(NotificationQueue* queue); // Unregisters a NotificationQueue.
    100101
    101102            // tolua_begin
    102             void loadQueues(void); //!< Loads all the NotificationQueues that should exist.
    103             void createQueue(const std::string& name); //!< Creates a new NotificationQueue.
    104             orxonox::NotificationQueue* getQueue(const std::string & name); //!< Get the NotificationQueue with the input name.
     103            void loadQueues(void); // Loads all the NotificationQueues that should exist.
     104            void createQueue(const std::string& name); // Creates a new NotificationQueue.
     105            orxonox::NotificationQueue* getQueue(const std::string & name); // Get the NotificationQueue with the input name.
    105106            // tolua_end
    106107
     
    113114            std::map<const std::string, NotificationQueue*> queues_; //!< The list of NotificationQueues created by the NotificationManager.
    114115
    115             bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input Notification form an input map.
     116            bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); // Helper method that removes an input Notification form an input map.
     117           
     118            // Commands
     119            void commandClear(const std::string& sender); // The clear command. Clears all NotificationQueues that have its sender as a target.
    116120
    117121    }; // tolua_export
Note: See TracChangeset for help on using the changeset viewer.