- Timestamp:
- May 28, 2011, 4:21:14 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tutoriallevel3/src/modules/notifications/NotificationQueue.h
r8453 r8636 45 45 #include "NotificationManager.h" 46 46 47 #include "core/BaseObject.h" 47 48 #include "tools/interfaces/Tickable.h" 48 49 … … 88 89 @ingroup Notifications 89 90 */ 90 class _NotificationsExport NotificationQueue : public Tickable91 class _NotificationsExport NotificationQueue : public BaseObject, public Tickable 91 92 { 92 93 93 94 public: 94 NotificationQueue(const std::string& name, const std::string& senders = NotificationListener::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME); 95 NotificationQueue(BaseObject* creator); 96 NotificationQueue(BaseObject* creator, const std::string& name, const std::string& senders = NotificationListener::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME); 95 97 virtual ~NotificationQueue(); 96 98 97 virtual void tick(float dt); //!< To update from time to time. 98 99 void update(void); //!< Updates the NotificationQueue. 100 void update(Notification* notification, const std::time_t & time); //!< Updates the NotificationQueue by adding an new Notification. 99 virtual void tick(float dt); // To update from time to time. 100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 101 102 void update(void); // Updates the NotificationQueue. 103 void update(Notification* notification, const std::time_t & time); // Updates the NotificationQueue by adding an new Notification. 101 104 102 105 // tolua_begin … … 105 108 @return Returns the name. 106 109 */ 107 inline const std::string& getName( ) const108 { return this-> name_; }109 110 void setMaxSize(unsigned int size); // !<Sets the maximum number of displayed Notifications.110 inline const std::string& getName(void) const 111 { return this->BaseObject::getName(); } 112 113 void setMaxSize(unsigned int size); // Sets the maximum number of displayed Notifications. 111 114 /** 112 115 @brief Returns the maximum number of Notifications displayed. 113 116 @return Returns maximum size. 114 117 */ 115 inline unsigned int getMaxSize( ) const118 inline unsigned int getMaxSize(void) const 116 119 { return this->maxSize_; } 117 120 118 void setDisplayTime(int time); // !<Sets the maximum number of seconds a Notification is displayed.121 void setDisplayTime(int time); // Sets the maximum number of seconds a Notification is displayed. 119 122 /** 120 123 @brief Returns the time interval the Notification is displayed. 121 124 @return Returns the display time. 122 125 */ 123 inline int getDisplayTime( ) const126 inline int getDisplayTime(void) const 124 127 { return this->displayTime_; } 125 128 // tolua_end … … 129 132 @return Returns the size of the NotificationQueue. 130 133 */ 131 inline unsigned int getSize( ) const134 inline unsigned int getSize(void) const 132 135 { return this->size_; } 133 136 … … 136 139 @return Returns a set of strings holding the different targets. 137 140 */ 138 inline const std::set<std::string> & getTargetsSet( )141 inline const std::set<std::string> & getTargetsSet(void) 139 142 { return this->targets_; } 140 143 141 void setTargets(const std::string & targets); //!< Set the targets of this NotificationQueue. 142 const std::string& getTargets(void) const; //!< Returns a string consisting of the concatenation of the targets. 144 void setTargets(const std::string & targets); // Set the targets of this NotificationQueue. 145 const std::string& getTargets(void) const; // Returns a string consisting of the concatenation of the targets. 146 147 /** 148 @brief Check whether the NotificationQueue is registered with the NotificationManager. 149 @return Returns true if it is registered, false if not. 150 */ 151 inline bool isRegistered(void) 152 { return this->registered_; } 143 153 144 154 bool tidy(void); // Pops all Notifications from the NotificationQueue. … … 160 170 virtual void notificationRemoved(unsigned int index) {} 161 171 162 virtual void clear(bool noGraphics = false); // !<Clears the NotificationQueue by removing all NotificationContainers.172 virtual void clear(bool noGraphics = false); // Clears the NotificationQueue by removing all NotificationContainers. 163 173 164 174 protected: … … 167 177 static const int INF = -1; //!< Constant denoting infinity. 168 178 179 virtual void create(void); // Creates the NotificationQueue. 180 169 181 private: 170 std::string name_; //!< The name of the NotificationQueue. 171 182 void initialize(void); // Initializes the NotificationQueue. 183 184 time_t creationTime_; // The time this NotificationQueue was created. 185 172 186 unsigned int maxSize_; //!< The maximal number of Notifications displayed. 173 187 unsigned int size_; //!< The number of Notifications displayed. … … 186 200 void setName(const std::string& name); //!< Sets the name of the NotificationQueue. 187 201 188 void push(Notification* notification, const std::time_t & time); // !<Adds (pushes) a Notification to the NotificationQueue.189 void pop(void); // !<Removes (pops) the least recently added Notification form the NotificationQueue.190 void remove(const std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator& containerIterator); // !<Removes the Notification that is stored in the input NotificationContainer.202 void push(Notification* notification, const std::time_t & time); // Adds (pushes) a Notification to the NotificationQueue. 203 void pop(void); // Removes (pops) the least recently added Notification form the NotificationQueue. 204 void remove(const std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator& containerIterator); // Removes the Notification that is stored in the input NotificationContainer. 191 205 192 206 };
Note: See TracChangeset
for help on using the changeset viewer.