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/NotificationQueue.h

    r7398 r7399  
    4343
    4444#include "tools/interfaces/Tickable.h"
     45
    4546#include "interfaces/NotificationListener.h"
    4647#include "NotificationManager.h"
     
    7677            virtual ~NotificationQueue();
    7778
     79            /**
     80            @brief Destroys the NotificationQueue.
     81                   Used in lua.
     82            */
    7883            void destroy(void) { this->OrxonoxClass::destroy(); } // tolua_export
    7984
    8085            virtual void tick(float dt); //!< To update from time to time.
    8186
    82             void update(void); //!< Updates the queue.
    83             void update(Notification* notification, const std::time_t & time); //!< Adds a Notification to the queue.
     87            void update(void); //!< Updates the NotificationQueue.
     88            void update(Notification* notification, const std::time_t & time); //!< Updates the NotificationQueue by adding an new Notification.
    8489
    8590            // tolua_begin
     
    110115            /**
    111116            @brief Returns the current number of Notifications displayed.
    112             @return Returns the size of the queue.
     117            @return Returns the size of the NotificationQueue.
    113118            */
    114119            inline unsigned int getSize() const
     
    116121
    117122            /**
    118             @brief Returns the targets of this queue, reps. the senders which Notifications are displayed in this queue.
    119             @return Retuns a set of string holding the different targets.
     123            @brief Returns the targets of this NotificationQueue, reps. the senders which Notifications are displayed in this NotificationQueue.
     124            @return Returns a set of strings holding the different targets.
    120125            */
    121126            inline const std::set<std::string, NotificationListenerStringCompare> & getTargetsSet()
     
    123128
    124129            // tolua_begin
    125             bool setTargets(const std::string & targets); //!< Set the targets of this NotificationQueue.
     130            void setTargets(const std::string & targets); //!< Set the targets of this NotificationQueue.
    126131            const std::string& getTargets(void) const; //!< Returns a string consisting of the concatination of the targets.
    127132            // tolua_end
     
    137142            unsigned int displayTime_; //!< The time a Notification is displayed.
    138143
    139             std::set<std::string, NotificationListenerStringCompare> targets_; //!< The targets the Queue displays Notifications of.
     144            bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
    140145
    141             std::multiset<NotificationContainer*, NotificationContainerCompare> ordering_; //!< The NotificationContainers ordered by the time they were registered. //TODO: Would set work as well?
     146            std::set<std::string, NotificationListenerStringCompare> targets_; //!< The targets the NotificationQueue displays Notifications of.
     147
     148            std::multiset<NotificationContainer*, NotificationContainerCompare> ordering_; //!< The NotificationContainers ordered by the time they were registered.
    142149            std::vector<NotificationContainer*> notifications_; //!< The NotificationContainers in the order they were added to the NotificationQueue.
    143150
     
    145152            NotificationContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired.
    146153
    147             bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
    148 
    149             void initialize(void); //!< Initializes the object.
    150154            void create(void); //!< Creates the NotificationQueue in lua.
    151155
    152             bool setName(const std::string& name); //!< Sets the name of the NotificationQueue.
     156            void setName(const std::string& name); //!< Sets the name of the NotificationQueue.
    153157
    154             void sizeChanged(void); //!< Adjusts the NotificationQueue, when the maximum size has changed.
     158            void push(Notification* notification, const std::time_t & time); //!< Adds (pushes) a Notification to the NotificationQueue.
     159            void pop(void); //!< Removes (pops) the least recently added Notification form the NotificationQueue.
     160            void remove(NotificationContainer* container); //!< Removes the Notification that is stored in the input NotificationContainer.
    155161
    156             void push(Notification* notification, const std::time_t & time); //!< Add a Notification to the NotificationQueue.
    157             void pop(void); //!< Removes the least recently added Notification form the NotificationQueue.
    158             void remove(NotificationContainer* container); //!< Removes the Notification that is stored in the input container.
    159 
    160             void clear(void); //!< Clears the queue by removing all Notifications.
     162            void clear(void); //!< Clears the NotificationQueue by removing all NotificationContainers.
    161163
    162164    }; // tolua_export
Note: See TracChangeset for help on using the changeset viewer.