Class NotificationInfo

Class Documentation

class NotificationInfo

NotificationInfo holds the state of a trigger like the pointer to the triggerOrigin, the notification id and the callback.

Public Functions

NotificationInfo() noexcept = default

constructs an empty NotificationInfo

virtual ~NotificationInfo() noexcept = default
template<typename T, typename ContextDataType>
NotificationInfo(T *const notificationOrigin, const uint64_t notificationId, const NotificationCallback<T, ContextDataType> &callback) noexcept

constructs a NotificationInfo object

Parameters:
  • notificationOrigin[in] the origin of the event

  • notificationId[in] id of the event

  • callback[in] the callback of the event

uint64_t getNotificationId() const noexcept

returns the notification id

Returns:

the empty NotificationInfo always returns INVALID_ID, otherwise the actual notificationId is returned which can also be INVALID_ID

template<typename T>
bool doesOriginateFrom(T *const notificationOrigin) const noexcept

confirms the notificationOrigin

Parameters:

notificationOrigin[in] the possible notificationOrigin

Returns:

true if the address is equal to the notificationOrigin, otherwise false. The empty NotificationInfo returns always false.

template<typename T>
T *getOrigin() const noexcept

returns the pointer to the notificationOrigin.

Returns:

If T equals the Triggerable type it returns the notificationOrigin. Otherwise it calls the errorHandler with a moderate error of kPOPO__EVENT_INFO_TYPE_INCONSISTENCY_IN_GET_ORIGIN and returns nullptr.

bool operator()() const noexcept

If a callback is set it executes the callback.

Returns:

true if the callback was called, otherwise false

Public Static Attributes

static constexpr uint64_t INVALID_ID = std::numeric_limits<uint64_t>::max()

Protected Attributes

void *m_notificationOrigin = nullptr
void *m_userValue = nullptr
uint64_t m_notificationOriginTypeHash = 0U
uint64_t m_notificationId = INVALID_ID
internal::GenericCallbackPtr_t m_callbackPtr = nullptr
internal::TranslationCallbackPtr_t m_callback = nullptr

Friends

friend class Trigger