PLCnext API Documentation
20.0.0.24462
|
Primary access to the NotificationManager More...
#include <NotificationManager.hpp>
Public Member Functions | |
NotificationManager (const NotificationManager &)=delete | |
NotificationManager (NotificationManager &&)=delete | |
NotificationManager & | operator= (const NotificationManager &)=delete |
NotificationManager & | operator= (NotificationManager &&)=delete |
template<typename PayloadType > | |
NotificationRegistration< PayloadType > | CreateNotificationRegistration (const String ¬ificationName, const String &senderName, Severity severity) |
Creates a NotificationRegistration proxy More... | |
template<typename PayloadType > | |
NonBlockingNotificationRegistration< PayloadType > | CreateNonBlockingNotificationRegistration (const String ¬ificationName, const String &senderName, Severity severity) |
Creates a NonBlockingNotificationRegistration proxy More... | |
template<typename PayloadType > | |
NonBlockingNotificationRegistration< PayloadType > | CreateNonBlockingNotificationRegistration2 (const String ¬ificationName, const String &senderName, Severity severity) |
NotificationSubscriber | CreateNotificationSubscriber (const String ¬ificationName) |
Creates a NotificationSubscriber proxy More... | |
NotificationNameIdType | RegisterNotification (const String ¬ificationName, const String &senderName, Severity severity, PayloadTypeIdType payloadTypeId) override |
Registers a new Notification More... | |
void | UnregisterNotification (NotificationNameIdType notificationNameId) override |
Unregisters a Nototification More... | |
NotificationIdType | SendNotification (NotificationNameIdType notificationNameId, Arp::DateTime timestamp, const RawPayloadType &payload) override |
Sends a notification More... | |
NotificationIdType | SendNotification (NotificationNameIdType notificationNameId, Arp::DateTime timestamp, const IPayload &payload) override |
Sends a notification More... | |
Future< NotificationNameIdType > | NonBlockingRegisterNotification (const String ¬ificationName, const String &senderName, Severity severity, PayloadTypeIdType payloadTypeId) override |
Registers a new Notification (non-blocking) More... | |
void | NonBlockingRegisterNotification (const String ¬ificationName, const String &senderName, Severity severity, PayloadTypeIdType payloadTypeId, Future< NotificationNameIdType > result) |
Future< void > | NonBlockingUnregisterNotification (NotificationNameIdType notificationNameId) override |
Unregisters a Nototification (non-blocking) More... | |
void | NonBlockingUnregisterNotification (NotificationNameIdType notificationNameId, Future< void > result) |
Future< NotificationIdType > | NonBlockingSendNotification (NotificationNameIdType notificationNameId, Arp::DateTime timestamp, const RawPayloadType &payload) override |
Sends a notification (non-blocking) More... | |
void | NonBlockingSendNotification (NotificationNameIdType notificationNameId, Arp::DateTime timestamp, std::function< RawPayloadType()> createPayloadFunctor, Future< NotificationIdType > result) |
Future< NotificationIdType > | NonBlockingSendNotification (NotificationNameIdType notificationNameId, Arp::DateTime timestamp, const IPayload &payload) override |
Sends a notification (non-blocking) More... | |
const String | GetNotificationName (NotificationNameIdType notificationNameId) const override |
Queries the NotifictionName More... | |
const NotificationNameIdType | GetNotificationNameId (const String ¬ificationName) override |
Queries the id of an NotificationName More... | |
const NotificationNameIdList | GetNotificationNameIdsByStatus (const NotificationRegistrationStatus &status) const override |
Queries the ids of Notifications with a given NotificationRegistrationStatus More... | |
const NotificationNameIdList | GetAllKnownNotificationNameIds () const override |
Queries of all known NotificationNameIds More... | |
const NotificationRegistrationInfo | GetNotificationRegistration (NotificationNameIdType notificationNameId) const override |
Queries information about an Notification More... | |
const PayloadTypeIdType | GetPayloadTypeId (const String &payloadTypeName) override |
Query an id for a given PayloadType More... | |
const String | GetPayloadTypeName (const PayloadTypeIdType &payloadTypeId) const override |
Query the payload type name of a given id More... | |
Arp::uint64 | GetNumberOfSubmittedNotifications () const override |
Returns the number of Notifications submitted since startup of the controller More... | |
NotificationNameIdType | Subscribe (const String ¬ificationName, INotificationSubscriber *subscriber) override |
Subscribe to a Notification More... | |
void | Unsubscribe (NotificationNameIdType notificationNameId, INotificationSubscriber *subscriber) override |
Unsubscribe from a Notification More... | |
void | UnsubscribeFromAll (INotificationSubscriber *subscriber) override |
Unsubscribe from all Notification More... | |
void | ReplaceSubscriber (INotificationSubscriber *oldSubscriber, INotificationSubscriber *newSubscriber) |
Protected Member Functions | |
NotificationManager (size_t nonBlockingNotificationSendingProxyQueueLength=128) | |
![]() | |
AppDomainSingleton (void)=default | |
The protected default constructor. More... | |
~AppDomainSingleton (void)=default | |
The protected default destructor. More... | |
Friends | |
class | AppDomainSingleton< NotificationManager > |
Additional Inherited Members | |
![]() | |
static NotificationManager & | CreateInstance (Args &&... args) |
Creates this singleton instance. More... | |
static bool | IsCreated (void) |
Determines if this singleton instance is created yet. More... | |
static NotificationManager & | GetInstance (void) |
Gets a reference of the singleton instance. More... | |
static NotificationManager * | GetInstancePtr (void) |
Gets a pointer to the singleton instance. More... | |
static void | DisposeInstance (void) |
Disposes this singleton instance. More... | |
![]() | |
typedef AppDomainSingleton< NotificationManager > | SingletonBase |
Defines this type to be used from derived classes. More... | |
Primary access to the NotificationManager
The NotificationManager provides a communication system with 1:n communication and loose coupling between components. Notifications contain some meta data like name and timestamp and also a payload defined by the sender. The payload should be defined by deriving a class from SpecializedPayload. See namespace Arp::System::NmPayload for examples.
The NotificationManager is implemented as a singleton. To access it use NotificationManager::GetInstance().
To send notifications they must be registered in advance. The simplest way is to use a NotificationRegistration object created by CreateNotificationRegistration(...). This acts a a proxy like a smart pointer.
To receive a notification a class must implement the INotificationSubscriber interface and subscribe to a Notification. This can be simplified using CreateNotificationSubscriber(...) method to create a NotificationSubscriber and add a callback function to its OnNotification event.
NonBlockingNotificationRegistration< PayloadType > Arp::System::Nm::NotificationManager::CreateNonBlockingNotificationRegistration | ( | const String & | notificationName, |
const String & | senderName, | ||
Severity | severity | ||
) |
Creates a NonBlockingNotificationRegistration proxy
notificationName | name of the notification (e.g. Arp.System.Nm.SomethingInterestingHappened) |
senderName | name of the sender of the notification |
severity | severity of the notification |
The template parameter PayloadType indicates the Payload class to be used when sending Notifications.
NotificationRegistration< PayloadType > Arp::System::Nm::NotificationManager::CreateNotificationRegistration | ( | const String & | notificationName, |
const String & | senderName, | ||
Severity | severity | ||
) |
Creates a NotificationRegistration proxy
notificationName | name of the notification (e.g. Arp.System.Nm.SomethingInterestingHappened) |
senderName | name of the sender of the notification |
severity | severity of the notification |
The template parameter PayloadType indicates the Payload class to be used when sending Notifications.
NotificationSubscriber Arp::System::Nm::NotificationManager::CreateNotificationSubscriber | ( | const String & | notificationName | ) |
Creates a NotificationSubscriber proxy
notificationName | Notification name to subscribe to |
|
overridevirtual |
Queries of all known NotificationNameIds
Implements Arp::System::Nm::INotificationManagerInfo.
|
overridevirtual |
Queries the NotifictionName
notificationNameId | NotificationNameId |
Implements Arp::System::Nm::INotificationManagerInfo.
|
overridevirtual |
Queries the id of an NotificationName
notificationName | NotificationName |
Implements Arp::System::Nm::INotificationManagerInfo.
|
overridevirtual |
Queries the ids of Notifications with a given NotificationRegistrationStatus
status | status of the queried Notifications |
Implements Arp::System::Nm::INotificationManagerInfo.
|
overridevirtual |
Queries information about an Notification
notificationNameId | NotificationNameId |
Implements Arp::System::Nm::INotificationManagerInfo.
|
overridevirtual |
Returns the number of Notifications submitted since startup of the controller
Implements Arp::System::Nm::INotificationManagerInfo.
|
overridevirtual |
Query an id for a given PayloadType
payloadTypeName | Name fo the payload type |
Implements Arp::System::Nm::INotificationManagerInfo.
|
overridevirtual |
Query the payload type name of a given id
payloadTypeId | id of the payload type |
Implements Arp::System::Nm::INotificationManagerInfo.
|
overridevirtual |
Registers a new Notification (non-blocking)
notificationName | name of the notification (e.g. Arp.System.Nm.SomethingInterestingHappened) |
senderName | name of the sender of the notification |
severity | severity of the notification |
payloadTypeId | id of the payload type |
Implements Arp::System::Nm::INonBlockingNotificationSending.
|
overridevirtual |
Sends a notification (non-blocking)
notificationNameId | id of the NotificationName to send |
timestamp | Current timestamp |
payload | payload to send |
Implements Arp::System::Nm::INonBlockingNotificationSending.
|
overridevirtual |
Sends a notification (non-blocking)
notificationNameId | id of the NotificationName to send |
timestamp | Current timestamp |
payload | payload to send |
Implements Arp::System::Nm::INonBlockingNotificationSending.
|
overridevirtual |
Unregisters a Nototification (non-blocking)
notificationNameId | id of the NotificationName to unregister |
Implements Arp::System::Nm::INonBlockingNotificationSending.
|
overridevirtual |
Registers a new Notification
notificationName | name of the notification (e.g. Arp.System.Nm.SomethingInterestingHappened) |
senderName | name of the sender of the notification |
severity | severity of the notification |
payloadTypeId | id of the payload type |
Implements Arp::System::Nm::INotificationSending.
|
overridevirtual |
Sends a notification
notificationNameId | id of the NotificationName to send |
timestamp | Current timestamp |
payload | payload to send |
Implements Arp::System::Nm::INotificationSending.
|
overridevirtual |
Sends a notification
notificationNameId | id of the NotificationName to send |
timestamp | Current timestamp |
payload | payload to send |
Implements Arp::System::Nm::INotificationSending.
|
overridevirtual |
Subscribe to a Notification
notificationName | Name of the Notification to subscribe to |
subscriber | Pointer to the ISubscriber (!= nullptr) |
Implements Arp::System::Nm::INotificationReceiving.
|
overridevirtual |
Unregisters a Nototification
notificationNameId | id of the NotificationName to unregister |
Implements Arp::System::Nm::INotificationSending.
|
overridevirtual |
Unsubscribe from a Notification
notificationName | Name of the Notification to unsubscribe from |
subscriber | Pointer to the ISubscriber (!= nullptr) |
Implements Arp::System::Nm::INotificationReceiving.
|
overridevirtual |
Unsubscribe from all Notification
subscriber | Pointer to the ISubscriber (!= nullptr) |
This function should be called before Subscriber is destructed!
Implements Arp::System::Nm::INotificationReceiving.