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),
101 template<
typename PayloadType>
105 NotificationSending(std::move(other.NotificationSending)),
106 NotificationNameId(std::move(other.NotificationNameId))
108 other.NotificationSending =
nullptr;
109 other.severity = Severity::Default;
113 template<
typename PayloadType>
120 template<
typename PayloadType>
129 base_type::operator=(std::move(other));
131 this->NotificationSending = std::move(other.NotificationSending);
132 other.NotificationSending =
nullptr;
134 this->NotificationNameId = std::move(other.NotificationNameId);
140 template<
typename PayloadType>
143 if (this->NotificationSending !=
nullptr && !this->NotificationNameId.
IsValid())
146 this->NotificationName, this->SenderName, this->severity, this->
GetPayloadTypeId());
151 template<
typename PayloadType>
154 if (this->NotificationSending !=
nullptr && this->NotificationNameId.
IsValid())
162 template<
typename PayloadType>
163 template<
typename... Args>
170 template<
typename PayloadType>
171 template<
typename... Args>
173 const DateTime& timestamp, Args&& ... args)
175 if (this->NotificationSending ==
nullptr)
179 if (!this->NotificationNameId.
IsValid())
184 this->NotificationNameId, timestamp, PayloadType{std::forward<Args>(args)...});
188 template<
class PayloadType>
191 return this->NotificationNameId;
NotificationNameIdType GetNotificationNameId() const override
Returns the NotificationNameId
Definition: NotificationRegistration.hpp:189
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:43
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:172
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:164
virtual NotificationIdType SendNotification(NotificationNameIdType notificationNameId, Arp::DateTime timestamp, const RawPayloadType &payload)=0
Sends a notification