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.

descriptor_base.hpp 2.2KB

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