Lely core libraries 2.3.4
event.hpp
Go to the documentation of this file.
1
24#ifndef LELY_IO2_EVENT_HPP_
25#define LELY_IO2_EVENT_HPP_
26
27#include <lely/io2/event.h>
28
29#if _WIN32
30#ifdef IN
31#undef IN
32#endif
33#ifdef OUT
34#undef OUT
35#endif
36#endif
37
38namespace lely {
39namespace io {
40
45enum class Event {
73 NONE = IO_EVENT_NONE,
74 MASK = IO_EVENT_MASK
75};
76
77constexpr Event
78operator~(Event rhs) {
79 return static_cast<Event>(~static_cast<int>(rhs));
80}
81
82constexpr Event
83operator&(Event lhs, Event rhs) {
84 return static_cast<Event>(static_cast<int>(lhs) & static_cast<int>(rhs));
85}
86
87constexpr Event
88operator^(Event lhs, Event rhs) {
89 return static_cast<Event>(static_cast<int>(lhs) ^ static_cast<int>(rhs));
90}
91
92constexpr Event
93operator|(Event lhs, Event rhs) {
94 return static_cast<Event>(static_cast<int>(lhs) | static_cast<int>(rhs));
95}
96
97inline Event&
98operator&=(Event& lhs, Event rhs) {
99 return lhs = lhs & rhs;
100}
101
102inline Event&
103operator^=(Event& lhs, Event rhs) {
104 return lhs = lhs ^ rhs;
105}
106
107inline Event&
108operator|=(Event& lhs, Event rhs) {
109 return lhs = lhs | rhs;
110}
111
112} // namespace io
113} // namespace lely
114
115#endif // !LELY_IO2_EVENT_HPP_
This header file is part of the I/O library; it contains the I/O event declarations.
@ IO_EVENT_HUP
The device has been disconnected.
Definition: event.h:56
@ IO_EVENT_IN
Data (other than priority data) MAY be read without blocking.
Definition: event.h:35
@ IO_EVENT_OUT
Data (bot normal and priority data) MAY be written without blocking.
Definition: event.h:46
@ IO_EVENT_ERR
An error has occurred. This event is always reported.
Definition: event.h:48
@ IO_EVENT_PRI
Priority data MAY be read without blocking.
Definition: event.h:40
Event
The type of I/O event monitored by lely::io::Poll::watch() and reported to io_poll_watch_func_t callb...
Definition: event.hpp:45
@ HUP
The device has been disconnected.
@ IN
Data (other than priority data) MAY be read without blocking.
@ PRI
Priority data MAY be read without blocking.
@ OUT
Data (bot normal and priority data) MAY be written without blocking.
@ ERR
Reception of error frames is enabled.