OpenCPN Partial API docs
Loading...
Searching...
No Matches
NotificationManager Class Reference

The global list of user notifications, a singleton. More...

#include <notification_manager.h>

Public Member Functions

 NotificationManager (const NotificationManager &)=delete
 
NotificationManageroperator= (const NotificationManager &)=delete
 
std::string AddNotification (std::shared_ptr< Notification > _notification)
 
std::string AddNotification (NotificationSeverity _severity, const std::string &_message, int timeout_secs=-1)
 Add a new notification.
 
bool AcknowledgeNotification (const std::string &guid)
 User ack on a notification which eventually will remove it.
 
NotificationSeverity GetMaxSeverity ()
 Return max severity among current active notifications.
 
const std::vector< std::shared_ptr< Notification > > & GetNotifications () const
 Return current active notifications.
 
size_t GetNotificationCount () const
 

Static Public Member Functions

static NotificationManagerGetInstance ()
 

Public Attributes

EventVar evt_notificationlist_change
 Notified without data when a notification is added or removed.
 

Detailed Description

The global list of user notifications, a singleton.

Definition at line 33 of file notification_manager.h.

Member Function Documentation

◆ AcknowledgeNotification()

bool NotificationManager::AcknowledgeNotification ( const std::string &  guid)

User ack on a notification which eventually will remove it.

Parameters
guidGuid obtained from AddNotification() or GetUUID().
Returns
true if the notification corresponding to guid exists.

Definition at line 85 of file notification_manager.cpp.

◆ AddNotification() [1/2]

std::string NotificationManager::AddNotification ( NotificationSeverity  _severity,
const std::string &  _message,
int  timeout_secs = -1 
)

Add a new notification.

Parameters
severityNotification type.
messagestring, possibly multiline. @oaram timeout_secs If given, the notifications is automatically removed after timeout_secs seconds if still existing.

Definition at line 75 of file notification_manager.cpp.

◆ AddNotification() [2/2]

std::string NotificationManager::AddNotification ( std::shared_ptr< Notification _notification)

Definition at line 68 of file notification_manager.cpp.

◆ GetInstance()

NotificationManager & NotificationManager::GetInstance ( )
static

Definition at line 33 of file notification_manager.cpp.

◆ GetMaxSeverity()

NotificationSeverity NotificationManager::GetMaxSeverity ( )

Return max severity among current active notifications.

Definition at line 59 of file notification_manager.cpp.

◆ GetNotificationCount()

size_t NotificationManager::GetNotificationCount ( ) const
inline

Definition at line 67 of file notification_manager.h.

◆ GetNotifications()

const std::vector< std::shared_ptr< Notification > > & NotificationManager::GetNotifications ( ) const
inline

Return current active notifications.

Definition at line 63 of file notification_manager.h.

Member Data Documentation

◆ evt_notificationlist_change

EventVar NotificationManager::evt_notificationlist_change

Notified without data when a notification is added or removed.

Definition at line 70 of file notification_manager.h.


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