Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
1.8KB

  1. //
  2. // detail/io_control.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  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)
  9. //
  10. #ifndef ASIO_DETAIL_IO_CONTROL_HPP
  11. #define ASIO_DETAIL_IO_CONTROL_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #include <cstddef>
  17. #include "asio/detail/socket_types.hpp"
  18. #include "asio/detail/push_options.hpp"
  19. namespace asio {
  20. namespace detail {
  21. namespace io_control {
  22. // I/O control command for getting number of bytes available.
  23. class bytes_readable
  24. {
  25. public:
  26. // Default constructor.
  27. bytes_readable()
  28. : value_(0)
  29. {
  30. }
  31. // Construct with a specific command value.
  32. bytes_readable(std::size_t value)
  33. : value_(static_cast<detail::ioctl_arg_type>(value))
  34. {
  35. }
  36. // Get the name of the IO control command.
  37. int name() const
  38. {
  39. return static_cast<int>(ASIO_OS_DEF(FIONREAD));
  40. }
  41. // Set the value of the I/O control command.
  42. void set(std::size_t value)
  43. {
  44. value_ = static_cast<detail::ioctl_arg_type>(value);
  45. }
  46. // Get the current value of the I/O control command.
  47. std::size_t get() const
  48. {
  49. return static_cast<std::size_t>(value_);
  50. }
  51. // Get the address of the command data.
  52. detail::ioctl_arg_type* data()
  53. {
  54. return &value_;
  55. }
  56. // Get the address of the command data.
  57. const detail::ioctl_arg_type* data() const
  58. {
  59. return &value_;
  60. }
  61. private:
  62. detail::ioctl_arg_type value_;
  63. };
  64. } // namespace io_control
  65. } // namespace detail
  66. } // namespace asio
  67. #include "asio/detail/pop_options.hpp"
  68. #endif // ASIO_DETAIL_IO_CONTROL_HPP