00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef ASIO_DETAIL_WIN_IOCP_OPERATION_HPP
00012 #define ASIO_DETAIL_WIN_IOCP_OPERATION_HPP
00013
00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00015 # pragma once
00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
00017
00018 #include "asio/detail/push_options.hpp"
00019
00020 #include "asio/detail/win_iocp_io_service_fwd.hpp"
00021
00022 #if defined(ASIO_HAS_IOCP)
00023
00024 #include "asio/detail/socket_types.hpp"
00025
00026 namespace asio {
00027 namespace detail {
00028
00029
00030
00031
00032
00033
00034
00035 struct win_iocp_operation
00036 : public OVERLAPPED
00037 {
00038 typedef void (*invoke_func_type)(win_iocp_operation*, DWORD, size_t);
00039 typedef void (*destroy_func_type)(win_iocp_operation*);
00040
00041 win_iocp_operation(invoke_func_type invoke_func,
00042 destroy_func_type destroy_func)
00043 : invoke_func_(invoke_func),
00044 destroy_func_(destroy_func)
00045 {
00046 Internal = 0;
00047 InternalHigh = 0;
00048 Offset = 0;
00049 OffsetHigh = 0;
00050 hEvent = 0;
00051 }
00052
00053 void do_completion(DWORD last_error, size_t bytes_transferred)
00054 {
00055 invoke_func_(this, last_error, bytes_transferred);
00056 }
00057
00058 void destroy()
00059 {
00060 destroy_func_(this);
00061 }
00062
00063 protected:
00064
00065 ~win_iocp_operation()
00066 {
00067 }
00068
00069 private:
00070 invoke_func_type invoke_func_;
00071 destroy_func_type destroy_func_;
00072 };
00073
00074 }
00075 }
00076
00077 #endif // defined(ASIO_HAS_IOCP)
00078
00079 #include "asio/detail/pop_options.hpp"
00080
00081 #endif // ASIO_DETAIL_WIN_IOCP_OPERATION_HPP