review: events
This commit is contained in:
parent
6ba7af53dc
commit
2a4a2976d4
@ -9,6 +9,8 @@
|
||||
|
||||
namespace uvw {
|
||||
|
||||
// base structures
|
||||
|
||||
|
||||
struct BaseEvent {
|
||||
virtual ~BaseEvent() noexcept = 0;
|
||||
@ -30,10 +32,28 @@ struct Event: BaseEvent {
|
||||
};
|
||||
|
||||
|
||||
struct AsyncEvent: Event<AsyncEvent> { };
|
||||
struct CheckEvent: Event<CheckEvent> { };
|
||||
struct CloseEvent: Event<CloseEvent> { };
|
||||
struct ConnectEvent: Event<ConnectEvent> { };
|
||||
// empty events
|
||||
|
||||
|
||||
struct DefaultEvent: Event<DefaultEvent> { };
|
||||
|
||||
using AsyncEvent = DefaultEvent;
|
||||
using CheckEvent = DefaultEvent;
|
||||
using CloseEvent = DefaultEvent;
|
||||
using ConnectEvent = DefaultEvent;
|
||||
using EndEvent = DefaultEvent;
|
||||
using IdleEvent = DefaultEvent;
|
||||
using ListenEvent = DefaultEvent;
|
||||
using PrepareEvent = DefaultEvent;
|
||||
using SendEvent = DefaultEvent;
|
||||
using ShutdownEvent = DefaultEvent;
|
||||
using TimerEvent = DefaultEvent;
|
||||
using UninitializedEvent = DefaultEvent;
|
||||
using WorkEvent = DefaultEvent;
|
||||
using WriteEvent = DefaultEvent;
|
||||
|
||||
|
||||
// specialized events
|
||||
|
||||
|
||||
struct DataEvent: Event<DataEvent> {
|
||||
@ -50,9 +70,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
struct EndEvent: Event<EndEvent> { };
|
||||
|
||||
|
||||
struct ErrorEvent: Event<ErrorEvent> {
|
||||
explicit ErrorEvent(int code = 0) noexcept: ec(code) { }
|
||||
|
||||
@ -89,13 +106,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
struct IdleEvent: Event<IdleEvent> { };
|
||||
struct ListenEvent: Event<ListenEvent> { };
|
||||
struct PrepareEvent: Event<PrepareEvent> { };
|
||||
struct SendEvent: Event<SendEvent> { };
|
||||
struct ShutdownEvent: Event<ShutdownEvent> { };
|
||||
|
||||
|
||||
struct SignalEvent: Event<SignalEvent> {
|
||||
explicit SignalEvent(int sig) noexcept: signum(sig) { }
|
||||
|
||||
@ -106,9 +116,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
struct TimerEvent: Event<TimerEvent> { };
|
||||
|
||||
|
||||
struct UDPDataEvent: Event<UDPDataEvent> {
|
||||
explicit UDPDataEvent(Addr addr, std::unique_ptr<const char[]> ptr, ssize_t l, bool trunc) noexcept
|
||||
: dt{std::move(ptr)}, len{l}, sndr{addr}, part{trunc}
|
||||
@ -127,9 +134,4 @@ private:
|
||||
};
|
||||
|
||||
|
||||
struct UninitializedEvent: Event<UninitializedEvent> { };
|
||||
struct WorkEvent: Event<WorkEvent> { };
|
||||
struct WriteEvent: Event<WriteEvent> { };
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user