1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/private/socketevtdispatch.h
3 // Purpose: wxSocketEventDispatcher class
4 // Authors: Angel Vidal
6 // Created: August 2006
7 // Copyright: (c) Angel Vidal
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_PRIVATE_SOCKETEVTDISPATCH_H_
13 #define _WX_PRIVATE_SOCKETEVTDISPATCH_H_
20 #include <sys/socket.h>
25 // forward declarations
26 class wxSocketEventDispatcherEntry
;
29 enum wxSocketEventDispatcherType
31 wxSocketEventDispatcherInput
,
32 wxSocketEventDispatcherOutput
35 class WXDLLIMPEXP_CORE wxSocketEventDispatcher
: public wxHashTable
38 wxSocketEventDispatcher() : wxHashTable(wxKEY_INTEGER
) {}
41 // returns instance of the table
42 static wxSocketEventDispatcher
& Get();
44 virtual ~wxSocketEventDispatcher()
46 WX_CLEAR_HASH_TABLE(*this)
49 void RegisterCallback(int fd
, wxSocketEventDispatcherType socketType
,
52 void UnregisterCallback(int fd
, wxSocketEventDispatcherType socketType
);
54 void RunLoop(int timeout
= 0);
57 void AddEvents(fd_set
* readset
, fd_set
* writeset
);
59 int FillSets(fd_set
* readset
, fd_set
* writeset
);
61 wxSocketEventDispatcherEntry
* FindEntry(int fd
);
64 static wxSocketEventDispatcher
*ms_instance
;
66 friend class wxSocketEventDispatcherModule
;
69 #endif // wxUSE_SOCKETS
71 #endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_