socket_handler.hpp 610 Bytes
Newer Older
1 2
#ifndef SOCKET_HANDLER_INTERFACE_HPP
# define SOCKET_HANDLER_INTERFACE_HPP
louiz’'s avatar
louiz’ committed
3

4 5 6 7 8
typedef int socket_t;

class SocketHandler
{
public:
9 10 11 12 13 14 15
  SocketHandler() {}
  virtual ~SocketHandler() {}
  virtual socket_t get_socket() const = 0;
  virtual void on_recv() = 0;
  virtual void on_send() = 0;
  virtual void connect() = 0;
  virtual bool is_connected() const = 0;
16 17 18 19 20 21 22
private:
  SocketHandler(const SocketHandler&) = delete;
  SocketHandler(SocketHandler&&) = delete;
  SocketHandler& operator=(const SocketHandler&) = delete;
  SocketHandler& operator=(SocketHandler&&) = delete;
};

23
#endif // SOCKET_HANDLER_INTERFACE_HPP