00001
00002 #pragma once
00003 #include "wvstreamclone.h"
00004 #include <map>
00005 #include <vector>
00006
00007 #define WM_SELECT (WM_USER)
00008 #define WM_DONESELECT (WM_USER+1)
00009
00010 class WvWinStreamClone :
00011 public WvStreamClone
00012 {
00013 public:
00014 WvWinStreamClone(WvStream *_cloned);
00015 ~WvWinStreamClone();
00016 static DWORD Initialize();
00017
00018 private:
00019
00020 typedef std::map<SOCKET, long> SocketEventsMap;
00021 typedef std::map<HWND, WvWinStreamClone *> WndStreamMap;
00022 typedef std::vector<HWND> WndVector;
00023
00024
00025 static ATOM s_aClass;
00026 static WndVector s_wndpool;
00027 static WndStreamMap s_wndmap;
00028 const static UINT_PTR TIMER_ID = 12345;
00029 static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
00030
00031
00032 SelectInfo m_si;
00033 int m_msec_timeout;
00034 HWND m_hWnd;
00035 bool m_pending_callback;
00036 bool m_select_in_progress;
00037
00038 void pre_poll();
00039 void post_poll();
00040 void select_set(SocketEventsMap &sockmap, fd_set *set, long event );
00041 void select_callback(SOCKET socket, int event, int error);
00042 HWND alloc_wnd();
00043 void free_wnd(HWND w);
00044
00045 };
00046
00047