2 // detail/io_control.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_DETAIL_IO_CONTROL_HPP
12 #define BOOST_ASIO_DETAIL_IO_CONTROL_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
20 #include <boost/asio/detail/socket_types.hpp>
22 #include <boost/asio/detail/push_options.hpp>
27 namespace io_control {
29 // I/O control command for getting number of bytes available.
33 // Default constructor.
39 // Construct with a specific command value.
40 bytes_readable(std::size_t value)
41 : value_(static_cast<detail::ioctl_arg_type>(value))
45 // Get the name of the IO control command.
48 return static_cast<int>(BOOST_ASIO_OS_DEF(FIONREAD));
51 // Set the value of the I/O control command.
52 void set(std::size_t value)
54 value_ = static_cast<detail::ioctl_arg_type>(value);
57 // Get the current value of the I/O control command.
58 std::size_t get() const
60 return static_cast<std::size_t>(value_);
63 // Get the address of the command data.
64 detail::ioctl_arg_type* data()
69 // Get the address of the command data.
70 const detail::ioctl_arg_type* data() const
76 detail::ioctl_arg_type value_;
79 } // namespace io_control
84 #include <boost/asio/detail/pop_options.hpp>
86 #endif // BOOST_ASIO_DETAIL_IO_CONTROL_HPP