aop_disconnect.hpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) 2017-2023 zhllxt
  3. *
  4. * author : zhllxt
  5. * email : 37792738@qq.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 __ASIO2_MQTT_AOP_DISCONNECT_HPP__
  11. #define __ASIO2_MQTT_AOP_DISCONNECT_HPP__
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. #pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <asio2/base/iopool.hpp>
  16. #include <asio2/base/detail/function_traits.hpp>
  17. #include <asio2/base/detail/util.hpp>
  18. #include <asio2/mqtt/message.hpp>
  19. namespace asio2::detail
  20. {
  21. template<class caller_t, class args_t>
  22. class mqtt_aop_disconnect
  23. {
  24. friend caller_t;
  25. protected:
  26. // server or client
  27. inline void _before_user_callback_impl(
  28. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  29. mqtt::v3::disconnect& msg)
  30. {
  31. detail::ignore_unused(ec, caller_ptr, caller, om, msg);
  32. }
  33. // server or client
  34. inline void _before_user_callback_impl(
  35. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  36. mqtt::v4::disconnect& msg)
  37. {
  38. detail::ignore_unused(ec, caller_ptr, caller, om, msg);
  39. }
  40. // server or client
  41. inline void _before_user_callback_impl(
  42. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  43. mqtt::v5::disconnect& msg)
  44. {
  45. detail::ignore_unused(ec, caller_ptr, caller, om, msg);
  46. }
  47. inline void _after_user_callback_impl(
  48. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  49. mqtt::v3::disconnect& msg)
  50. {
  51. detail::ignore_unused(ec, caller_ptr, caller, om, msg);
  52. }
  53. inline void _after_user_callback_impl(
  54. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  55. mqtt::v4::disconnect& msg)
  56. {
  57. detail::ignore_unused(ec, caller_ptr, caller, om, msg);
  58. }
  59. inline void _after_user_callback_impl(
  60. error_code& ec, std::shared_ptr<caller_t>& caller_ptr, caller_t* caller, mqtt::message& om,
  61. mqtt::v5::disconnect& msg)
  62. {
  63. detail::ignore_unused(ec, caller_ptr, caller, om, msg);
  64. }
  65. };
  66. }
  67. #endif // !__ASIO2_MQTT_AOP_DISCONNECT_HPP__