Chris@16: // Chris@16: // detail/reactor_op.hpp Chris@16: // ~~~~~~~~~~~~~~~~~~~~~ Chris@16: // Chris@101: // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: Chris@16: #ifndef BOOST_ASIO_DETAIL_REACTOR_OP_HPP Chris@16: #define BOOST_ASIO_DETAIL_REACTOR_OP_HPP Chris@16: Chris@16: #if defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: # pragma once Chris@16: #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace asio { Chris@16: namespace detail { Chris@16: Chris@16: class reactor_op Chris@16: : public operation Chris@16: { Chris@16: public: Chris@16: // The error code to be passed to the completion handler. Chris@16: boost::system::error_code ec_; Chris@16: Chris@16: // The number of bytes transferred, to be passed to the completion handler. Chris@16: std::size_t bytes_transferred_; Chris@16: Chris@16: // Perform the operation. Returns true if it is finished. Chris@16: bool perform() Chris@16: { Chris@16: return perform_func_(this); Chris@16: } Chris@16: Chris@16: protected: Chris@16: typedef bool (*perform_func_type)(reactor_op*); Chris@16: Chris@16: reactor_op(perform_func_type perform_func, func_type complete_func) Chris@16: : operation(complete_func), Chris@16: bytes_transferred_(0), Chris@16: perform_func_(perform_func) Chris@16: { Chris@16: } Chris@16: Chris@16: private: Chris@16: perform_func_type perform_func_; Chris@16: }; Chris@16: Chris@16: } // namespace detail Chris@16: } // namespace asio Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_ASIO_DETAIL_REACTOR_OP_HPP