9 #include "Arp/System/Nm/INotificationSending.hpp" 10 #include "Arp/System/Nm/NotificationRegistrationBase.hpp" 12 namespace Arp {
namespace System {
namespace Nm
28 template<
typename PayloadType>
36 using payload_type = PayloadType;
66 template<
typename... Args>
73 template<
typename... Args>
81 void DisposeImpl()
override;
90 template<
typename PayloadType>
93 :
base_type(notificationName, senderName, severity),
94 NotificationSending(¬ificationSending)
100 template<
typename PayloadType>
104 NotificationSending(std::move(other.NotificationSending)),
105 NotificationNameId(std::move(other.NotificationNameId))
107 other.NotificationSending =
nullptr;
108 other.severity = Severity::Default;
112 template<
typename PayloadType>
119 template<
typename PayloadType>
128 base_type::operator=(std::move(other));
130 this->NotificationSending = std::move(other.NotificationSending);
131 other.NotificationSending =
nullptr;
133 this->NotificationNameId = std::move(other.NotificationNameId);
139 template<
typename PayloadType>
142 if (this->NotificationSending !=
nullptr && !this->NotificationNameId.
IsValid())
145 this->NotificationName, this->SenderName, this->severity, this->
GetPayloadTypeId());
150 template<
typename PayloadType>
153 if (this->NotificationSending !=
nullptr && this->NotificationNameId.
IsValid())
161 template<
typename PayloadType>
162 template<
typename... Args>
169 template<
typename PayloadType>
170 template<
typename... Args>
172 const DateTime& timestamp, Args&& ... args)
174 if (this->NotificationSending ==
nullptr)
178 if (!this->NotificationNameId.
IsValid())
183 this->NotificationNameId, timestamp, PayloadType{std::forward<Args>(args)...});
187 template<
class PayloadType>
190 return this->NotificationNameId;
NotificationNameIdType GetNotificationNameId() const override
Returns the NotificationNameId
Definition: NotificationRegistration.hpp:188
NotificationRegistration()=default
Creates an empty NotificationRegistration
IdType< Arp::uint64, struct NotificationIdTag > NotificationIdType
type for Notification ids
Definition: NotificationManagerTypes.hpp:19
void Dispose() noexcept
Unregisters the Notification and release all resources
Definition: NotificationRegistrationBase.hpp:78
virtual void UnregisterNotification(NotificationNameIdType notificationNameId)=0
Unregisters a Nototification
virtual NotificationNameIdType RegisterNotification(const String ¬ificationName, const String &senderName, Severity severity, PayloadTypeIdType payloadTypeId)=0
Registers a new Notification
The class contains date and time informations.
Definition: DateTime.hpp:44
constexpr bool IsValid() const noexcept
Returns true if this object represents a valid id (!= 0)
Definition: IdType.hpp:87
Interface for sending of notifications
Definition: INotificationSending.hpp:20
static DateTime Now(void)
Gets the current time as DateTime, expressed as the UTC time.
Severity
Enumeration of Severities for notifications
Definition: Severity.hpp:15
Root namespace for the PLCnext API
Base class with common behavior of NotificationRegistration and NonBlockingNotificationRegistration
Definition: NotificationRegistrationBase.hpp:19
Proxy object for a NotificationRegistration
Definition: NotificationRegistration.hpp:29
NotificationIdType SendNotificationWithTimestamp(const DateTime ×tamp, Args &&... args)
Sends a notification with a specified timestamp
Definition: NotificationRegistration.hpp:171
PayloadTypeIdType GetPayloadTypeId() const
Returns the PayloadTypeId
Definition: NotificationRegistrationBase.hpp:119
IdType< Arp::uint32, struct NotificationNameIdTag > NotificationNameIdType
type for Notification name ids
Definition: NotificationManagerTypes.hpp:22
System components used by the System, Device, Plc or Io domains.
NotificationIdType SendNotification(Args &&... args)
Sends a notification
Definition: NotificationRegistration.hpp:163
virtual NotificationIdType SendNotification(NotificationNameIdType notificationNameId, Arp::DateTime timestamp, const RawPayloadType &payload)=0
Sends a notification