From c85b624d28564a6f785b25000e2b7825592a919d Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 26 Sep 2017 20:09:31 +0200 Subject: Initial commit --- src/looper.hh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/looper.hh (limited to 'src/looper.hh') diff --git a/src/looper.hh b/src/looper.hh new file mode 100644 index 0000000..4dfe56f --- /dev/null +++ b/src/looper.hh @@ -0,0 +1,31 @@ +#ifndef LOOPER_HH +#define LOOPER_HH + +#include + +class Looper { +public: + virtual ~Looper() {} + + static uint8_t const EV_READ; + static uint8_t const EV_WRITE; + static uint8_t const EV_ERR; + + virtual void add(int fd, uint8_t events, + std::function + const& callback) = 0; + virtual void modify(int fd, uint8_t events) = 0; + virtual void remove(int fd) = 0; + + // Returned id is never 0 + virtual uint32_t schedule( + double delay, std::function const& callback) = 0; + virtual void cancel(uint32_t id) = 0; + +protected: + Looper() {} + Looper(Looper const&) = delete; + Looper& operator=(Looper const&) = delete; +}; + +#endif // LOOPER_HH -- cgit v1.3