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_
21 // forward declarations
22 class wxSocketEventDispatcherEntry
;
25 enum wxSocketEventDispatcherType
27 wxSocketEventDispatcherInput
,
28 wxSocketEventDispatcherOutput
31 class WXDLLIMPEXP_CORE wxSocketEventDispatcher
: public wxHashTable
34 wxSocketEventDispatcher() : wxHashTable(wxKEY_INTEGER
) {}
37 // returns instance of the table
38 static wxSocketEventDispatcher
& Get();
40 virtual ~wxSocketEventDispatcher()
42 WX_CLEAR_HASH_TABLE(*this)
45 void RegisterCallback(int fd
, wxSocketEventDispatcherType socketType
,
48 void UnregisterCallback(int fd
, wxSocketEventDispatcherType socketType
);
50 void RunLoop(int timeout
= 0);
53 void AddEvents(fd_set
* readset
, fd_set
* writeset
);
55 int FillSets(fd_set
* readset
, fd_set
* writeset
);
57 wxSocketEventDispatcherEntry
* FindEntry(int fd
);
60 static wxSocketEventDispatcher
*ms_instance
;
62 friend class wxSocketEventDispatcherModule
;
65 #endif // wxUSE_SOCKETS
67 #endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_