00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00026 #ifndef OW32_IoCompletion_h
00027 #define OW32_IoCompletion_h
00028
00029 #include <OW32/windows.h>
00030 #include <OW32/OW32Libs.h>
00031
00032 namespace OW32
00033 {
00034
00036 class OW32_LIB_EXPORT CIoCompletion
00037 {
00038 public:
00045 virtual void OnIoCompletion(BOOL bRet, DWORD dwBytes, LPOVERLAPPED lpOS) = 0;
00046 };
00047
00052 #define DLL_IMPLEMENT_IO_COMPLETION(className, declspec) \
00053 typedef void (className::*CompletionFn)(BOOL bRet, DWORD dwBytes, LPOVERLAPPED lpOS); \
00054 \
00055 \
00056 struct declspec OVERLAPPEDPLUS : public OVERLAPPED \
00057 { \
00058 \
00059 CompletionFn lpCompletion; \
00060 }; \
00061 \
00062 virtual void OnIoCompletion(BOOL bRet, DWORD dwBytes, LPOVERLAPPED lpOS) \
00063 { \
00064 OVERLAPPEDPLUS* lpOSPlus = (OVERLAPPEDPLUS*)lpOS; \
00065 (this->*(lpOSPlus->lpCompletion))(bRet, dwBytes, lpOS); \
00066 }
00067
00071 #define IMPLEMENT_IO_COMPLETION(className) \
00072 typedef void (className::*CompletionFn)(BOOL bRet, DWORD dwBytes, LPOVERLAPPED lpOS); \
00073 \
00074 \
00075 struct OVERLAPPEDPLUS : public OVERLAPPED \
00076 { \
00077 \
00078 CompletionFn lpCompletion; \
00079 }; \
00080 \
00081 virtual void OnIoCompletion(BOOL bRet, DWORD dwBytes, LPOVERLAPPED lpOS) \
00082 { \
00083 OVERLAPPEDPLUS* lpOSPlus = (OVERLAPPEDPLUS*)lpOS; \
00084 (this->*(lpOSPlus->lpCompletion))(bRet, dwBytes, lpOS); \
00085 }
00086
00087 }
00088
00089 #endif // OW32_IoCompletion_h