orxonox::NotificationManager Class Reference

The Singleton NotificationManager functions as a gateway between Notifications and NotificationQueues. It receives, organizes Notifications and the redistributes them to the specific NotificationQueues. More...

#include <src/orxonox/overlays/notifications/NotificationManager.h>

Inheritance diagram for orxonox::NotificationManager:

orxonox::OrxonoxClass

List of all members.

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 NotificationManagergetInstance ()
 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 NotificationManagersingletonRef_s = NULL


Detailed Description

The Singleton NotificationManager functions as a gateway between Notifications and NotificationQueues. It receives, organizes Notifications and the redistributes them to the specific NotificationQueues.

Author:
Damian 'Mozork' Frick

Constructor & Destructor Documentation

orxonox::NotificationManager::NotificationManager (  ) 

Constructor. Registers the Object.

References highestIndex_, RegisterRootObject, and singletonRef_s.

orxonox::NotificationManager::~NotificationManager (  )  [virtual]

Destructor.


Member Function Documentation

NotificationManager & orxonox::NotificationManager::getInstance (  )  [static]

Returns the current (and single) instance of the NotificationManager. Creates one, if there isn't one to begin with.

Returns:
Returns a reference to the single instance of the NotificationManager.

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.

Parameters:
queue The NotificationQueue the Notifications are fetched for.
map A multimap, in which the notifications are stored.
timeDelay The timespan.
Returns:
Returns true if successful.

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.

Parameters:
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.
Returns:
Returns true if successful.

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.

Parameters:
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.
Returns:
Returns true if successful.

< 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.

Parameters:
notification The Notification to be registered.
Returns:
Returns true if successful.

< 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.

Parameters:
queue The NotificationQueue to be registered.
Returns:
Returns true if successful.

< 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().


Member Data Documentation

Container where all notifications are stored (together with their respecive timestamps).

Referenced by registerNotification(), and registerQueue().

This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.

Referenced by NotificationManager(), and registerQueue().

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().

Container where all NotificationQueues are stored with a number as identifier.

Referenced by getNotifications(), registerNotification(), and registerQueue().

Referenced by getInstance(), and NotificationManager().


The documentation for this class was generated from the following files:

Generated on Tue Jul 28 16:22:48 2009 for Orxonox by  doxygen 1.5.6