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.

127 lines
2.9KB

  1. //
  2. // detail/is_executor.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_IS_EXECUTOR_HPP
  11. #define ASIO_DETAIL_IS_EXECUTOR_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 "asio/detail/type_traits.hpp"
  17. #include "asio/detail/push_options.hpp"
  18. namespace asio {
  19. namespace detail {
  20. struct executor_memfns_base
  21. {
  22. void context();
  23. void on_work_started();
  24. void on_work_finished();
  25. void dispatch();
  26. void post();
  27. void defer();
  28. };
  29. template <typename T>
  30. struct executor_memfns_derived
  31. : T, executor_memfns_base
  32. {
  33. };
  34. template <typename T, T>
  35. struct executor_memfns_check
  36. {
  37. };
  38. template <typename>
  39. char (&context_memfn_helper(...))[2];
  40. template <typename T>
  41. char context_memfn_helper(
  42. executor_memfns_check<
  43. void (executor_memfns_base::*)(),
  44. &executor_memfns_derived<T>::context>*);
  45. template <typename>
  46. char (&on_work_started_memfn_helper(...))[2];
  47. template <typename T>
  48. char on_work_started_memfn_helper(
  49. executor_memfns_check<
  50. void (executor_memfns_base::*)(),
  51. &executor_memfns_derived<T>::on_work_started>*);
  52. template <typename>
  53. char (&on_work_finished_memfn_helper(...))[2];
  54. template <typename T>
  55. char on_work_finished_memfn_helper(
  56. executor_memfns_check<
  57. void (executor_memfns_base::*)(),
  58. &executor_memfns_derived<T>::on_work_finished>*);
  59. template <typename>
  60. char (&dispatch_memfn_helper(...))[2];
  61. template <typename T>
  62. char dispatch_memfn_helper(
  63. executor_memfns_check<
  64. void (executor_memfns_base::*)(),
  65. &executor_memfns_derived<T>::dispatch>*);
  66. template <typename>
  67. char (&post_memfn_helper(...))[2];
  68. template <typename T>
  69. char post_memfn_helper(
  70. executor_memfns_check<
  71. void (executor_memfns_base::*)(),
  72. &executor_memfns_derived<T>::post>*);
  73. template <typename>
  74. char (&defer_memfn_helper(...))[2];
  75. template <typename T>
  76. char defer_memfn_helper(
  77. executor_memfns_check<
  78. void (executor_memfns_base::*)(),
  79. &executor_memfns_derived<T>::defer>*);
  80. template <typename T>
  81. struct is_executor_class
  82. : integral_constant<bool,
  83. sizeof(context_memfn_helper<T>(0)) != 1 &&
  84. sizeof(on_work_started_memfn_helper<T>(0)) != 1 &&
  85. sizeof(on_work_finished_memfn_helper<T>(0)) != 1 &&
  86. sizeof(dispatch_memfn_helper<T>(0)) != 1 &&
  87. sizeof(post_memfn_helper<T>(0)) != 1 &&
  88. sizeof(defer_memfn_helper<T>(0)) != 1>
  89. {
  90. };
  91. template <typename T>
  92. struct is_executor
  93. : conditional<is_class<T>::value,
  94. is_executor_class<T>,
  95. false_type>::type
  96. {
  97. };
  98. } // namespace detail
  99. } // namespace asio
  100. #include "asio/detail/pop_options.hpp"
  101. #endif // ASIO_DETAIL_IS_EXECUTOR_HPP