8#include "Arp/System/Commons/Threading/LockGuard.hpp" 
    9#include "Arp/System/Commons/Threading/Mutex.hpp" 
   10#include "Arp/System/Nm/NonBlockingNotificationRegistration3ArgumentsBuffer.hpp" 
   11#include "Arp/System/Nm/NonBlockingNotificationRegistration3Base.hpp" 
   12#include "Arp/System/Nm/NonBlockingNotificationSendingAdapter.hpp" 
   13#include "Arp/System/Nm/NotificationRegistrationBase.hpp" 
   16namespace Arp { 
namespace System { 
namespace Nm
 
   19class NotificationManager;
 
   50template<
typename PayloadType, 
typename ArgumentsType = 
typename PayloadType::ArgumentsType>
 
   61    using payload_type = PayloadType;
 
   62    using arguments_type = ArgumentsType;
 
   64    static_assert(std::is_constructible<PayloadType, typename std::add_const<ArgumentsType>::type>::value,
 
   65                  "PayloadType must be constructible by const ArgumentsType!");
 
   66    static_assert(std::is_default_constructible<ArgumentsType>::value, 
"ArgumentType must be default constructible");
 
   67    static_assert(std::is_copy_assignable<ArgumentsType>::value, 
"ArgumentsType must be copy assignable");
 
   73                                         size_t argumentsBufferCapacity, std::unique_ptr<NonBlockingNotificationSendingAdapter> adapter);
 
   92    template<
typename... Args>
 
   99    template<
typename... Args>
 
  106    void DisposeImpl() 
override;
 
  116    std::shared_ptr<ArgumentsBuffer> argumentsBuffer = 
nullptr;
 
  119template<
typename PayloadType, 
typename ArgumentsType>
 
  121    const String& notificationName, 
const String& senderName, 
Severity severity, 
size_t argumentsBufferCapacity,
 
  122    std::unique_ptr<NonBlockingNotificationSendingAdapter> adapter)
 
  123    : base_type(notificationName, senderName, severity),
 
  125      argumentsBuffer(
std::make_shared<ArgumentsBuffer>(argumentsBufferCapacity))
 
  127    this->Register(notificationName, senderName, severity, this->
GetPayloadTypeId());
 
  130template<
typename PayloadType, 
typename ArgumentsType>
 
  133    : base_type(std::move(other)),
 
  135      argumentsBuffer(std::move(other.argumentsBuffer))
 
  139template<
typename PayloadType, 
typename ArgumentsType>
 
  145template<
typename PayloadType, 
typename ArgumentsType>
 
  146NonBlockingNotificationRegistration3<PayloadType, ArgumentsType>&
 
  147NonBlockingNotificationRegistration3<PayloadType, ArgumentsType>::operator=(
 
  148    NonBlockingNotificationRegistration3<PayloadType, ArgumentsType>&& other) 
noexcept 
  155    base_type::operator=(std::move(other));
 
  156    NonBlockingNotificationRegistration3Base::operator=(std::move(other));
 
  158    this->argumentsBuffer = std::move(other.argumentsBuffer);
 
  163template<
typename PayloadType, 
typename ArgumentsType>
 
  164void NonBlockingNotificationRegistration3<PayloadType, ArgumentsType>::DisposeImpl()
 
  169template<
typename PayloadType, 
typename ArgumentsType>
 
  170template<
typename... Args>
 
  174    return this->SendNotificationWithTimestamp(
DateTime::GetUtcNow(), std::forward<Args>(args)...);
 
  177template<
typename PayloadType, 
typename ArgumentsType>
 
  178template<
typename... Args>
 
  181    const DateTime& timestamp, Args&& ... args)
 
  183    static_assert(std::is_constructible<ArgumentsType, Args...>::value,
 
  184                  "The ArgumentsType must be constructible by the passed arguments (Args).");
 
  186    if (this->IsReadyToSend())
 
  188        auto insertResult = this->argumentsBuffer->Insert(ArgumentsType{std::forward<Args>(args)...});
 
  189        this->SendNotificationInternal(
 
  190            timestamp, this->argumentsBuffer, insertResult, &NonBlockingNotificationRegistration3::CreatePayload);
 
  194        this->ResetFutureNotificationId();
 
  196    return this->GetFutureNotificationId();
 
  199template<
typename PayloadType, 
typename ArgumentsType>
 
  202    return this->GetNotificationNameIdInternal();
 
  205template<
typename PayloadType, 
typename ArgumentsType>
 
  207    CreatePayloadFunctorArg arg)
 
  209    auto buffer = std::dynamic_pointer_cast<ArgumentsBuffer>(arg.BufferPtr);
 
  215    auto removeResult = buffer->Remove(arg.Index);
 
  216    if (!removeResult.IsValid)
 
  221    return PayloadType{removeResult.Args}.MoveOutRawPayload();
 
This class contains date and time informations.
Definition: DateTime.hpp:27
 
static DateTime GetUtcNow(void)
Gets the current time in UTC.
Definition: DateTime.cpp:186
 
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
 
Future object as proxy for return value an asynchronous function call
Definition: Future.hpp:68
 
Definition: NonBlockingNotificationRegistration3ArgumentsBuffer.hpp:21
 
Internal class for pimpl pattern
Definition: NonBlockingNotificationRegistration3Base.hpp:20
 
Proxy object for a non-blocking NotificationRegistration
Definition: NonBlockingNotificationRegistration3.hpp:54
 
Future< NotificationIdType > SendNotification(Args &&... args)
Sends a notification
Definition: NonBlockingNotificationRegistration3.hpp:171
 
NonBlockingNotificationRegistration3()=default
Creates an empty NotificationRegistration
 
NotificationNameIdType GetNotificationNameId() const override
Returns the NotificationNameId
Definition: NonBlockingNotificationRegistration3.hpp:200
 
Future< NotificationIdType > SendNotificationWithTimestamp(const DateTime ×tamp, Args &&... args)
Sends a notification with a specified timestamp
Definition: NonBlockingNotificationRegistration3.hpp:180
 
Primary access to the NotificationManager
Definition: NotificationManager.hpp:48
 
Base class with common behavior of NotificationRegistration and NonBlockingNotificationRegistration
Definition: NotificationRegistrationBase.hpp:24
 
PayloadTypeIdType GetPayloadTypeId() const
Returns the PayloadTypeId
Definition: NotificationRegistrationBase.hpp:114
 
enum ARP_CXX_SYMBOL_EXPORT Severity
Enumeration of Severities for notifications
Definition: Severity.hpp:14
 
std::vector< Arp::Base::Rsc::Commons::RscVariant< RawPayloadTypeLength > > RawPayloadType
type for the internally transferred payloads
Definition: NotificationManagerTypes.hpp:32
 
Root namespace for the PLCnext API
 
Namespace of the C++ standard library
 
Definition: NonBlockingNotificationSendingAdapter.hpp:29