timer_queue_base.hpp 1.5 KB

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