subscription.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright Takatoshi Kondo 2020
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #if !defined(MQTT_BROKER_SUBSCRIPTION_HPP)
  7. #define MQTT_BROKER_SUBSCRIPTION_HPP
  8. #include <mqtt/config.hpp>
  9. #include <mqtt/broker/broker_namespace.hpp>
  10. #include <mqtt/optional.hpp>
  11. #include <mqtt/subscribe_options.hpp>
  12. #include <mqtt/buffer.hpp>
  13. #include <mqtt/broker/session_state_fwd.hpp>
  14. MQTT_BROKER_NS_BEGIN
  15. struct subscription {
  16. subscription(
  17. session_state_ref ss,
  18. buffer share_name,
  19. buffer topic_filter,
  20. subscribe_options subopts,
  21. optional<std::size_t> sid)
  22. :ss { ss },
  23. share_name { force_move(share_name) },
  24. topic_filter { force_move(topic_filter) },
  25. subopts { subopts },
  26. sid { sid }
  27. {}
  28. session_state_ref ss;
  29. buffer share_name;
  30. buffer topic_filter;
  31. subscribe_options subopts;
  32. optional<std::size_t> sid;
  33. };
  34. inline bool operator<(subscription const& lhs, subscription const& rhs) {
  35. return &lhs.ss.get() < &rhs.ss.get();
  36. }
  37. MQTT_BROKER_NS_END
  38. #endif // MQTT_BROKER_SUBSCRIPTION_HPP