#include <src/orxonox/overlays/notifications/NotificationManager.h>
Public Member Functions | |
bool | getNotifications (NotificationQueue *queue, std::multimap< std::time_t, Notification * > *map, int timeDelay) |
Fetches the Notifications for a specific NotificationQueue starting at a specified timespan before now. | |
bool | getNotifications (NotificationQueue *queue, std::multimap< std::time_t, Notification * > *map, const std::time_t &timeFrameStart) |
Fetches the Notifications for a specific NotificationQueue starting at a specified time. | |
bool | getNotifications (NotificationQueue *queue, std::multimap< std::time_t, Notification * > *map, const std::time_t &timeFrameStart, const std::time_t &timeFrameEnd) |
Returns the Notifications for a specific NotificationQueue in a specified timeframe. | |
NotificationManager () | |
Constructor. Registers the Object. | |
bool | registerNotification (Notification *notification) |
Returns a reference to the single instance of the NotificationManager. | |
bool | registerQueue (NotificationQueue *queue) |
Registers a NotificationQueue within the NotificationManager. | |
virtual | ~NotificationManager () |
Destructor. | |
Static Public Member Functions | |
static NotificationManager & | getInstance () |
Returns the current (and single) instance of the NotificationManager. Creates one, if there isn't one to begin with. | |
Static Public Attributes | |
static const std::string | ALL = "all" |
static const std::string | NONE = "none" |
Private Attributes | |
std::multimap< std::time_t, Notification * > | allNotificationsList_ |
Container where all notifications are stored (together with their respecive timestamps). | |
int | highestIndex_ |
This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice. | |
std::map< int, std::multimap < std::time_t, Notification * > * > | notificationLists_ |
Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored. | |
std::map< NotificationQueue *, int > | queueList_ |
Container where all NotificationQueues are stored with a number as identifier. | |
Static Private Attributes | |
static NotificationManager * | singletonRef_s = NULL |
orxonox::NotificationManager::NotificationManager | ( | ) |
Constructor. Registers the Object.
References highestIndex_, RegisterRootObject, and singletonRef_s.
orxonox::NotificationManager::~NotificationManager | ( | ) | [virtual] |
Destructor.
NotificationManager & orxonox::NotificationManager::getInstance | ( | ) | [static] |
Returns the current (and single) instance of the NotificationManager. Creates one, if there isn't one to begin with.
References singletonRef_s.
Referenced by orxonox::NotificationQueue::initialize(), orxonox::Notification::send(), and orxonox::NotificationQueue::update().
bool orxonox::NotificationManager::getNotifications | ( | NotificationQueue * | queue, | |
std::multimap< std::time_t, Notification * > * | map, | |||
int | timeDelay | |||
) | [inline] |
Fetches the Notifications for a specific NotificationQueue starting at a specified timespan before now.
queue | The NotificationQueue the Notifications are fetched for. | |
map | A multimap, in which the notifications are stored. | |
timeDelay | The timespan. |
bool orxonox::NotificationManager::getNotifications | ( | NotificationQueue * | queue, | |
std::multimap< std::time_t, Notification * > * | map, | |||
const std::time_t & | timeFrameStart | |||
) | [inline] |
Fetches the Notifications for a specific NotificationQueue starting at a specified time.
queue | The NotificationQueue the Notifications are fetched for. | |
map | A multimap, in which the notifications are stored. | |
timeFrameStart | The start time the Notifications are fetched from. |
bool orxonox::NotificationManager::getNotifications | ( | NotificationQueue * | queue, | |
std::multimap< std::time_t, Notification * > * | map, | |||
const std::time_t & | timeFrameStart, | |||
const std::time_t & | timeFrameEnd | |||
) |
Returns the Notifications for a specific NotificationQueue in a specified timeframe.
Fetches the Notifications for a specific NotificationQueue in a specified timeframe.
queue | The NotificationQueue the Notifications are fetched for. | |
map | A multimap, in which the notifications are stored. | |
timeFrameStart | The start time of the timeframe. | |
timeFrameEnd | The end time of the timeframe. |
< The Notifications for the input NotificationQueue.
< Returns NULL, if there are no Notifications.
< Iterate through the Notifications from the start of the time Frame to the end of it.
< Add the found Notifications to the map.
References notificationLists_, and queueList_.
bool orxonox::NotificationManager::registerNotification | ( | Notification * | notification | ) |
Returns a reference to the single instance of the NotificationManager.
Registers a Notification within the NotificationManager and makes sure that the Notification is displayed in all the NotificationQueues associated with its sender.
Registers a Notification within the NotificationManager.
notification | The Notification to be registered. |
< A NULL-Notification cannot be registered.
< If the sender has no specific name, then the Notification is only added to the list of all Notifications.
< If all are the sender, then the Notifications is added to every NotificationQueue.
< Insert the notification in all queues that have its sender as target.
< Iterate through all queues.
< Insert the Notification in the Notifications list of the current NotificationQueue.
< Update the queue.
References ALL, allNotificationsList_, COUT, orxonox::Notification::getSender(), NONE, notificationLists_, and queueList_.
Referenced by orxonox::Notification::send().
bool orxonox::NotificationManager::registerQueue | ( | NotificationQueue * | queue | ) |
Registers a NotificationQueue within the NotificationManager.
queue | The NotificationQueue to be registered. |
< Add the NotificationQueue to the list of queues.
If all senders are the target of the queue, then the list of notification for that specific queue is te same as the list of all Notifications.
Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationQueue.
< Checks whether the overlay has the sender of the current notification as target.
< Update the queue.
References ALL, allNotificationsList_, COUT, orxonox::NotificationQueue::getTargetsSet(), highestIndex_, notificationLists_, queueList_, and orxonox::NotificationQueue::update().
Referenced by orxonox::NotificationQueue::initialize().
const std::string orxonox::NotificationManager::ALL = "all" [static] |
Referenced by registerNotification(), registerQueue(), and orxonox::NotificationQueue::setDefaults().
std::multimap<std::time_t,Notification*> orxonox::NotificationManager::allNotificationsList_ [private] |
Container where all notifications are stored (together with their respecive timestamps).
Referenced by registerNotification(), and registerQueue().
int orxonox::NotificationManager::highestIndex_ [private] |
This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
Referenced by NotificationManager(), and registerQueue().
const std::string orxonox::NotificationManager::NONE = "none" [static] |
Referenced by orxonox::Notification::initialize(), registerNotification(), and orxonox::Notification::send().
std::map<int,std::multimap<std::time_t,Notification*>*> orxonox::NotificationManager::notificationLists_ [private] |
Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored.
Referenced by getNotifications(), registerNotification(), and registerQueue().
std::map<NotificationQueue*,int> orxonox::NotificationManager::queueList_ [private] |
Container where all NotificationQueues are stored with a number as identifier.
Referenced by getNotifications(), registerNotification(), and registerQueue().
NotificationManager * orxonox::NotificationManager::singletonRef_s = NULL [static, private] |
Referenced by getInstance(), and NotificationManager().