Veethree D7 SDK
Loading...
Searching...
No Matches
io_event_notification.h
Go to the documentation of this file.
1
5#ifndef IO_EVENT_NOTIFICATION_H
6#define IO_EVENT_NOTIFICATION_H
7
8#include <any>
9#include <chrono>
10#include <cstdint>
11#include <memory>
12
13#include "io_event_common.h"
14#include "io_event_queue.h"
15
16using namespace std::chrono_literals;
17
18namespace vsdk::io {
19
24
28using event_notification_id = uint32_t;
29
37
45 std::chrono::milliseconds interval{ 0ms };
47 std::chrono::high_resolution_clock::time_point next{ 0ms };
48};
49
73
77class event_notification { // NOLINT(*-special-member-functions)
78public:
84 event_notification(const event_notification& other) = delete;
87
88 virtual ~event_notification() noexcept;
93 event_notification& operator=(const event_notification& other) = delete;
94 event_notification& operator=(event_notification&& other) noexcept;
96
158
162 virtual void start_notifications();
166 virtual void stop_notifications();
167
168protected:
180 virtual bool process_notification(const event_notification_descriptor& desc) const noexcept = 0;
181
182private:
183 class impl;
184 std::unique_ptr<impl> _impl;
185};
186
188
189} // namespace vsdk::io
190
191#endif // IO_EVENT_NOTIFICATION_H
virtual bool process_notification(const event_notification_descriptor &desc) const noexcept=0
Notification processing interface.
virtual void start_notifications()
Start the event notifications.
virtual bool remove_notification(event_notification_id id)
Remove a notification identified by 'id'.
event_notification()
Class constructors.
virtual void remove_all_notifications()
Remove all notifications.
event_notification(event_notification &&other) noexcept
Class constructors.
virtual void stop_notifications()
Stop the event notifications.
event_notification(const event_notification &other)=delete
Class constructors.
virtual event_notification_id add_notification(const event_notification_descriptor &desc)
Add a definition when an event must be notified.
Describes the source of an event.
Definition io_event_source.h:25
event_type
Describes the event type.
Definition io_event_common.h:41
uint32_t event_notification_id
Identifies a specific notification entry.
Definition io_event_notification.h:28
event_notification_frequency
Specifies the type of notifications.
Definition io_event_notification.h:33
@ none
indicates event_type default value.
Definition io_event_common.h:42
@ single_shot
single_shot means a notification is generated once
Definition io_event_notification.h:35
@ continuous
continuous means a notification will be rescheduled
Definition io_event_notification.h:34
IO event common data types.
IO event queue interface.
Any entities that belong to the IO library.
The event_notification_descriptor class.
Definition io_event_notification.h:55
std::shared_ptr< event_queue > queue
event_queue where the event will be created
Definition io_event_notification.h:59
std::any value
value The trigger value for the notification, it depends on the event_type. For threshould events tha...
Definition io_event_notification.h:71
event_notification_schedule schedule
event_notification_schedule details how often a notification occur
Definition io_event_notification.h:65
event_type type
event_type specifies the type of the event
Definition io_event_notification.h:63
event_source source
event_source specifies where the event values come from
Definition io_event_notification.h:61
The event_notification_schedule class.
Definition io_event_notification.h:41
event_notification_frequency freq
event_notification_frequency specifies the periodicity of a notification
Definition io_event_notification.h:43
std::chrono::milliseconds interval
specifies how often a notification will be evaluated
Definition io_event_notification.h:45
std::chrono::high_resolution_clock::time_point next
reserved
Definition io_event_notification.h:47