Veethree D7 SDK
Loading...
Searching...
No Matches
io_event_queue.h
Go to the documentation of this file.
1
5#ifndef IO_EVENT_QUEUE_H
6#define IO_EVENT_QUEUE_H
7
8#include <functional>
9#include <memory>
10
11#include "io_event.h"
12#include "io_event_common.h"
13
14namespace vsdk::io {
15
20
27using event_handler = std::function<void(std::shared_ptr<event>)>;
28
34using event_handler_id = uint32_t;
35
45class event_queue {
46public:
47 event_queue();
48 event_queue(const event_queue& eq) = delete;
49 event_queue(event_queue&& eq) noexcept = delete;
50 ~event_queue();
51
52 event_queue& operator=(const event_queue&) = delete;
53 event_queue& operator=(event_queue&& eq) noexcept = delete;
54
87 event_type evt_type,
88 event_handler evt_handler);
99
105 void push_event(std::shared_ptr<event> evt);
110
111private:
112 class impl;
113 std::unique_ptr<impl> _impl;
114};
115
116
117} // namespace vsdk::io
118
119#endif // IO_EVENT_QUEUE_H
void remove_all_handlers()
Remove all handlers for this queue.
void push_event(std::shared_ptr< event > evt)
Push an event into the queue.
event_handler_id add_handler(event_source evt_src, event_type evt_type, event_handler evt_handler)
Add an event handler for a specific type of event.
void flush_events()
Flush all events from the queue. Handlers will not be called for existing items in the queue.
bool remove_handler(event_handler_id id)
Remove an event handler from the event queue.
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_handler_id
Event handler Id.
Definition io_event_queue.h:34
std::function< void(std::shared_ptr< event >)> event_handler
Event handler function definition.
Definition io_event_queue.h:27
IO event interface.
IO event common data types.
Any entities that belong to the IO library.