Chris@16: // Chris@16: // posix/descriptor_base.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_POSIX_DESCRIPTOR_BASE_HPP Chris@16: #define BOOST_ASIO_POSIX_DESCRIPTOR_BASE_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: Chris@16: #if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ Chris@16: || defined(GENERATING_DOCUMENTATION) 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 posix { Chris@16: Chris@16: /// The descriptor_base class is used as a base for the basic_stream_descriptor Chris@16: /// class template so that we have a common place to define the associated Chris@16: /// IO control commands. Chris@16: class descriptor_base Chris@16: { Chris@16: public: Chris@16: /// (Deprecated: Use non_blocking().) IO control command to set the blocking Chris@16: /// mode of the descriptor. Chris@16: /** Chris@16: * Implements the FIONBIO IO control command. Chris@16: * Chris@16: * @par Example Chris@16: * @code Chris@16: * boost::asio::posix::stream_descriptor descriptor(io_service); Chris@16: * ... Chris@16: * boost::asio::descriptor_base::non_blocking_io command(true); Chris@16: * descriptor.io_control(command); Chris@16: * @endcode Chris@16: * Chris@16: * @par Concepts: Chris@16: * IoControlCommand. Chris@16: */ Chris@16: #if defined(GENERATING_DOCUMENTATION) Chris@16: typedef implementation_defined non_blocking_io; Chris@16: #else Chris@16: typedef boost::asio::detail::io_control::non_blocking_io non_blocking_io; Chris@16: #endif Chris@16: Chris@16: /// IO control command to get the amount of data that can be read without Chris@16: /// blocking. Chris@16: /** Chris@16: * Implements the FIONREAD IO control command. Chris@16: * Chris@16: * @par Example Chris@16: * @code Chris@16: * boost::asio::posix::stream_descriptor descriptor(io_service); Chris@16: * ... Chris@16: * boost::asio::descriptor_base::bytes_readable command(true); Chris@16: * descriptor.io_control(command); Chris@16: * std::size_t bytes_readable = command.get(); Chris@16: * @endcode Chris@16: * Chris@16: * @par Concepts: Chris@16: * IoControlCommand. Chris@16: */ Chris@16: #if defined(GENERATING_DOCUMENTATION) Chris@16: typedef implementation_defined bytes_readable; Chris@16: #else Chris@16: typedef boost::asio::detail::io_control::bytes_readable bytes_readable; Chris@16: #endif Chris@16: Chris@16: protected: Chris@16: /// Protected destructor to prevent deletion through this type. Chris@16: ~descriptor_base() Chris@16: { Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace posix Chris@16: } // namespace asio Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) Chris@16: // || defined(GENERATING_DOCUMENTATION) Chris@16: Chris@16: #endif // BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP