PLCnext API Documentation 25.0.2.69
Public Member Functions | Public Attributes | List of all members
Arp::System::Nm::NotificationSubscriber Class Reference

Proxy class for an subscriber of notifications More...

#include <NotificationSubscriber.hpp>

Inheritance diagram for Arp::System::Nm::NotificationSubscriber:
Inheritance graph

Public Member Functions

 NotificationSubscriber ()
 Creates an empty subscriber More...
 
 NotificationSubscriber (const String &notificationName, INotificationReceiving &notificationReceiving)
 Deprecated! Create a proxy and subscribe to a Notification More...
 
 NotificationSubscriber (const String &notificationName)
 Create a proxy and subscribe to a Notification More...
 
 NotificationSubscriber (const NotificationSubscriber &)=delete
 
 NotificationSubscriber (NotificationSubscriber &&other)
 
NotificationSubscriberoperator= (const NotificationSubscriber &)=delete
 
NotificationSubscriberoperator= (NotificationSubscriber &&other)
 
void Dispose () noexcept
 Unsubscribe and release alll resources
 
void Notify (const Notification &notification) override
 Called by the NotificationManager when a Notification is dipatched More...
 
const String GetNotificationName () const
 Returns the NotificationName
 
const NotificationNameIdType GetNotificationNameId () const
 Returns the NotificationNameId
 
virtual void Notify (const Notification &notification)=0
 Called to notify about an notification More...
 

Public Attributes

Arp::event< const Notification & > OnNotification
 Event to be fired on a Notification More...
 

Additional Inherited Members

- Static Protected Attributes inherited from Arp::System::Commons::Diagnostics::Logging::Loggable< NotificationSubscriber >
static Logger< NotificationSubscriberlog
 

Detailed Description

Proxy class for an subscriber of notifications

This class supports move semantics. It can be default constructed (e.g. in a component) and initialized by assigning an object with parameters.

When Notify is called while a move operation takes place there could be a race condition in the list of OnNotification (Arp::event). Therefore this object contains a mutex. Before any move operation the mutexes on this and the moved from object are locked.

Constructor & Destructor Documentation

◆ NotificationSubscriber() [1/3]

Arp::System::Nm::NotificationSubscriber::NotificationSubscriber ( )
default

Creates an empty subscriber

This object is not subscribed to anything. Use move semantics to transfer subscriptions from another object.

◆ NotificationSubscriber() [2/3]

Arp::System::Nm::NotificationSubscriber::NotificationSubscriber ( const String notificationName,
INotificationReceiving notificationReceiving 
)

Deprecated! Create a proxy and subscribe to a Notification

Parameters
notificationNameName of the Notification to subscribe to
notificationReceivingReference to the NotificationManager
Deprecated:
Use NotificationSubscriber(notificationName) instead. notificationReceiving is ignored.

◆ NotificationSubscriber() [3/3]

Arp::System::Nm::NotificationSubscriber::NotificationSubscriber ( const String notificationName)
explicit

Create a proxy and subscribe to a Notification

Parameters
notificationNameName of the Notification to subscribe to

Uses the NotificationManager singleton

Member Function Documentation

◆ Notify()

void Arp::System::Nm::NotificationSubscriber::Notify ( const Notification notification)
overridevirtual

Called by the NotificationManager when a Notification is dipatched

Override this funtion to implemet custom behavior.

Implements Arp::System::Nm::INotificationSubscriber.

Member Data Documentation

◆ OnNotification

Arp::event<const Notification&> Arp::System::Nm::NotificationSubscriber::OnNotification

Event to be fired on a Notification

Use += and make_delegate to register a callback.


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