diff options
Diffstat (limited to 'src/looper.hh')
| -rw-r--r-- | src/looper.hh | 31 |
1 files changed, 31 insertions, 0 deletions
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 <functional> + +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<void(Looper*, int, uint8_t)> + 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<void(Looper*, uint32_t)> const& callback) = 0; + virtual void cancel(uint32_t id) = 0; + +protected: + Looper() {} + Looper(Looper const&) = delete; + Looper& operator=(Looper const&) = delete; +}; + +#endif // LOOPER_HH |
