Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:01

0001 //
0002 // posix/descriptor_base.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP
0012 #define BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 
0020 #if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \
0021   || defined(GENERATING_DOCUMENTATION)
0022 
0023 #include <boost/asio/detail/io_control.hpp>
0024 #include <boost/asio/detail/socket_option.hpp>
0025 
0026 #include <boost/asio/detail/push_options.hpp>
0027 
0028 namespace boost {
0029 namespace asio {
0030 namespace posix {
0031 
0032 /// The descriptor_base class is used as a base for the descriptor class as a
0033 /// place to define the associated IO control commands.
0034 class descriptor_base
0035 {
0036 public:
0037   /// Wait types.
0038   /**
0039    * For use with descriptor::wait() and descriptor::async_wait().
0040    */
0041   enum wait_type
0042   {
0043     /// Wait for a descriptor to become ready to read.
0044     wait_read,
0045 
0046     /// Wait for a descriptor to become ready to write.
0047     wait_write,
0048 
0049     /// Wait for a descriptor to have error conditions pending.
0050     wait_error
0051   };
0052 
0053   /// IO control command to get the amount of data that can be read without
0054   /// blocking.
0055   /**
0056    * Implements the FIONREAD IO control command.
0057    *
0058    * @par Example
0059    * @code
0060    * boost::asio::posix::stream_descriptor descriptor(my_context);
0061    * ...
0062    * boost::asio::descriptor_base::bytes_readable command(true);
0063    * descriptor.io_control(command);
0064    * std::size_t bytes_readable = command.get();
0065    * @endcode
0066    *
0067    * @par Concepts:
0068    * IoControlCommand.
0069    */
0070 #if defined(GENERATING_DOCUMENTATION)
0071   typedef implementation_defined bytes_readable;
0072 #else
0073   typedef boost::asio::detail::io_control::bytes_readable bytes_readable;
0074 #endif
0075 
0076 protected:
0077   /// Protected destructor to prevent deletion through this type.
0078   ~descriptor_base()
0079   {
0080   }
0081 };
0082 
0083 } // namespace posix
0084 } // namespace asio
0085 } // namespace boost
0086 
0087 #include <boost/asio/detail/pop_options.hpp>
0088 
0089 #endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
0090        //   || defined(GENERATING_DOCUMENTATION)
0091 
0092 #endif // BOOST_ASIO_POSIX_DESCRIPTOR_BASE_HPP