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 
38 namespace lely {
39 namespace io {
40 
45 enum class Event {
52  IN = IO_EVENT_IN,
57  PRI = IO_EVENT_PRI,
63  OUT = IO_EVENT_OUT,
65  ERR = IO_EVENT_ERR,
72  HUP = IO_EVENT_HUP,
73  NONE = IO_EVENT_NONE,
74  MASK = IO_EVENT_MASK
75 };
76 
77 constexpr Event
78 operator~(Event rhs) {
79  return static_cast<Event>(~static_cast<int>(rhs));
80 }
81 
82 constexpr Event
83 operator&(Event lhs, Event rhs) {
84  return static_cast<Event>(static_cast<int>(lhs) & static_cast<int>(rhs));
85 }
86 
87 constexpr Event
88 operator^(Event lhs, Event rhs) {
89  return static_cast<Event>(static_cast<int>(lhs) ^ static_cast<int>(rhs));
90 }
91 
92 constexpr Event
93 operator|(Event lhs, Event rhs) {
94  return static_cast<Event>(static_cast<int>(lhs) | static_cast<int>(rhs));
95 }
96 
97 inline Event&
98 operator&=(Event& lhs, Event rhs) {
99  return lhs = lhs & rhs;
100 }
101 
102 inline Event&
103 operator^=(Event& lhs, Event rhs) {
104  return lhs = lhs ^ rhs;
105 }
106 
107 inline Event&
108 operator|=(Event& lhs, Event rhs) {
109  return lhs = lhs | rhs;
110 }
111 
112 } // namespace io
113 } // namespace lely
114 
115 #endif // !LELY_IO2_EVENT_HPP_
IO_EVENT_PRI
@ IO_EVENT_PRI
Priority data MAY be read without blocking.
Definition: event.h:40
IO_EVENT_HUP
@ IO_EVENT_HUP
The device has been disconnected.
Definition: event.h:56
IO_EVENT_IN
@ IO_EVENT_IN
Data (other than priority data) MAY be read without blocking.
Definition: event.h:35
event.h
IO_EVENT_OUT
@ IO_EVENT_OUT
Data (bot normal and priority data) MAY be written without blocking.
Definition: event.h:46
IO_EVENT_ERR
@ IO_EVENT_ERR
An error has occurred. This event is always reported.
Definition: event.h:48
lely::io::Event
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