timer_queue_base.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // detail/timer_queue_base.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2018 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 BOOST_ASIO_DETAIL_TIMER_QUEUE_BASE_HPP
  11. #define BOOST_ASIO_DETAIL_TIMER_QUEUE_BASE_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <boost/asio/detail/noncopyable.hpp>
  17. #include <boost/asio/detail/op_queue.hpp>
  18. #include <boost/asio/detail/operation.hpp>
  19. #include <boost/asio/detail/push_options.hpp>
  20. namespace boost {
  21. namespace asio {
  22. namespace detail {
  23. class timer_queue_base
  24. : private noncopyable
  25. {
  26. public:
  27. // Constructor.
  28. timer_queue_base() : next_(0) {}
  29. // Destructor.
  30. virtual ~timer_queue_base() {}
  31. // Whether there are no timers in the queue.
  32. virtual bool empty() const = 0;
  33. // Get the time to wait until the next timer.
  34. virtual long wait_duration_msec(long max_duration) const = 0;
  35. // Get the time to wait until the next timer.
  36. virtual long wait_duration_usec(long max_duration) const = 0;
  37. // Dequeue all ready timers.
  38. virtual void get_ready_timers(op_queue<operation>& ops) = 0;
  39. // Dequeue all timers.
  40. virtual void get_all_timers(op_queue<operation>& ops) = 0;
  41. private:
  42. friend class timer_queue_set;
  43. // Next timer queue in the set.
  44. timer_queue_base* next_;
  45. };
  46. template <typename Time_Traits>
  47. class timer_queue;
  48. } // namespace detail
  49. } // namespace asio
  50. } // namespace boost
  51. #include <boost/asio/detail/pop_options.hpp>
  52. #endif // BOOST_ASIO_DETAIL_TIMER_QUEUE_BASE_HPP