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.

92 lines
2.3KB

  1. //
  2. // posix/descriptor_base.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 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_POSIX_DESCRIPTOR_BASE_HPP
  11. #define ASIO_POSIX_DESCRIPTOR_BASE_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. #if defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \
  17. || defined(GENERATING_DOCUMENTATION)
  18. #include "asio/detail/io_control.hpp"
  19. #include "asio/detail/socket_option.hpp"
  20. #include "asio/detail/push_options.hpp"
  21. namespace asio {
  22. namespace posix {
  23. /// The descriptor_base class is used as a base for the basic_stream_descriptor
  24. /// class template so that we have a common place to define the associated
  25. /// IO control commands.
  26. class descriptor_base
  27. {
  28. public:
  29. /// Wait types.
  30. /**
  31. * For use with basic_descriptor::wait() and basic_descriptor::async_wait().
  32. */
  33. enum wait_type
  34. {
  35. /// Wait for a descriptor to become ready to read.
  36. wait_read,
  37. /// Wait for a descriptor to become ready to write.
  38. wait_write,
  39. /// Wait for a descriptor to have error conditions pending.
  40. wait_error
  41. };
  42. /// IO control command to get the amount of data that can be read without
  43. /// blocking.
  44. /**
  45. * Implements the FIONREAD IO control command.
  46. *
  47. * @par Example
  48. * @code
  49. * asio::posix::stream_descriptor descriptor(io_context);
  50. * ...
  51. * asio::descriptor_base::bytes_readable command(true);
  52. * descriptor.io_control(command);
  53. * std::size_t bytes_readable = command.get();
  54. * @endcode
  55. *
  56. * @par Concepts:
  57. * IoControlCommand.
  58. */
  59. #if defined(GENERATING_DOCUMENTATION)
  60. typedef implementation_defined bytes_readable;
  61. #else
  62. typedef asio::detail::io_control::bytes_readable bytes_readable;
  63. #endif
  64. protected:
  65. /// Protected destructor to prevent deletion through this type.
  66. ~descriptor_base()
  67. {
  68. }
  69. };
  70. } // namespace posix
  71. } // namespace asio
  72. #include "asio/detail/pop_options.hpp"
  73. #endif // defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
  74. // || defined(GENERATING_DOCUMENTATION)
  75. #endif // ASIO_POSIX_DESCRIPTOR_BASE_HPP