PLCnext API Documentation 25.0.2.69
NotificationSubscriber.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6
7#pragma once
8
10#include "Arp/System/Core/event.hxx"
11#include "Arp/System/Commons/Diagnostics/Logging/Loggable.hxx"
12#include "Arp/System/Nm/INotificationReceiving.hpp"
13#include "Arp/System/Nm/INotificationSubscriber.hpp"
14
15namespace Arp { namespace System { namespace Nm
16{
17
18
27class ARP_CXX_SYMBOL_EXPORT NotificationSubscriber
29 , public Arp::System::Commons::Diagnostics::Logging::Loggable<NotificationSubscriber>
30{
31public:
33 ARP_DEPRECATED("Use NotificationSubscriber(notificationName) instead. notificationReceiving is ignored.")
35 const String& notificationName, INotificationReceiving& notificationReceiving);
36 explicit NotificationSubscriber(const String& notificationName);
39 ~NotificationSubscriber() override;
40 NotificationSubscriber& operator=(const NotificationSubscriber&) = delete;
44 Arp::event<const Notification&> OnNotification;
45 void Dispose() noexcept;
46 void Notify(const Notification& notification) override;
47 const String GetNotificationName() const;
48 const NotificationNameIdType GetNotificationNameId() const;
49
50private: // methods
51 void Initialize();
52 bool IsInitialized() const;
53 void TranferSubscriptionFrom(NotificationSubscriber& other);
54
55private: // fields
56
57 // NotificationReceiving is not used any more. It will be removed in future versions.
58 INotificationReceiving* NotificationReceiving = nullptr;
59
60 String NotificationName;
61 NotificationNameIdType NotificationNameId;
62};
63
64}}} // namespace Arp::System::Nm
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
Use this class to register and invoke several delegates (function pointer in OOP design).
Definition: event.hxx:32
Derive from this class to inherit logging functionality.
Definition: Loggable.hxx:28
Interface for subscribers of Notifications
Definition: INotificationReceiving.hpp:20
Interface for subscribers of Notifications
Definition: INotificationSubscriber.hpp:21
Proxy class for an subscriber of notifications
Definition: NotificationSubscriber.hpp:30
NotificationSubscriber()
Creates an empty subscriber
Contains meta data and paylod of a Notification
Definition: Notification.hpp:20
Root namespace for the PLCnext API
class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
Deprecated! The class implements an adapter for enums to define the string literals of the enum entri...
Definition: EnumStrings.hxx:38