19 #ifndef __XRD_CL_POLLER_HH__
20 #define __XRD_CL_POLLER_HH__
65 virtual void Event( uint8_t type,
78 ev.erase( ev.length()-1, 1) ;
138 uint16_t timeout = 60 ) = 0;
149 uint16_t timeout = 60 ) = 0;
Interface for socket pollers.
virtual bool Start()=0
Start polling.
virtual bool IsRunning() const =0
Is the event loop running?
virtual bool Finalize()=0
Finalize the poller.
virtual ~Poller()
Destructor.
virtual bool EnableReadNotification(Socket *socket, bool notify, uint16_t timeout=60)=0
virtual bool EnableWriteNotification(Socket *socket, bool notify, uint16_t timeout=60)=0
virtual bool AddSocket(Socket *socket, SocketHandler *handler)=0
virtual bool RemoveSocket(Socket *socket)=0
Remove the socket.
virtual bool Initialize()=0
Initialize the poller.
virtual bool IsRegistered(Socket *socket)=0
Check whether the socket is registered with the poller.
virtual bool Stop()=0
Stop polling.
virtual void Finalize()
Finalizer.
virtual void Event(uint8_t type, Socket *socket)=0
Called when an event occurred on a given socket.
@ ReadTimeOut
Read timeout.
@ ReadyToWrite
Writing won't block.
@ WriteTimeOut
Write timeout.
@ ReadyToRead
New data has arrived.
static std::string EventTypeToString(uint8_t event)
Translate the event type to a string.
virtual void Initialize(Poller *)
Initializer.