Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
SocketPoller.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Engine - Network module"
3 // For conditions of distribution and use, see copyright notice in Config.hpp
4 
5 #pragma once
6 
7 #ifndef NAZARA_SOCKETPOLLER_HPP
8 #define NAZARA_SOCKETPOLLER_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Core/MovablePtr.hpp>
12 #include <Nazara/Network/AbstractSocket.hpp>
13 
14 namespace Nz
15 {
16  class SocketPollerImpl;
17 
18  class NAZARA_NETWORK_API SocketPoller
19  {
20  public:
21  SocketPoller();
22  SocketPoller(SocketPoller&&) noexcept = default;
23  ~SocketPoller();
24 
25  void Clear();
26 
27  bool IsReadyToRead(const AbstractSocket& socket) const;
28  bool IsReadyToWrite(const AbstractSocket& socket) const;
29  bool IsRegistered(const AbstractSocket& socket) const;
30 
31  bool RegisterSocket(AbstractSocket& socket, SocketPollEventFlags eventFlags);
32  void UnregisterSocket(AbstractSocket& socket);
33 
34  bool Wait(int msTimeout);
35 
36  SocketPoller& operator=(SocketPoller&&) noexcept = default;
37 
38  private:
40  };
41 }
42 
43 #include <Nazara/Network/SocketPoller.inl>
44 
45 #endif // NAZARA_SOCKETPOLLER_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Network class allowing an application to wait on multiples sockets for them to become active (readabl...
Definition: SocketPoller.hpp:18
Core class used to combine enumeration values into flags bitfield.
Definition: Flags.hpp:24
Network class that represents the base of socket.
Definition: AbstractSocket.hpp:18