timer_queue_base.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // timer_queue_base.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2008 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/push_options.hpp>
  16. #include <boost/asio/detail/socket_types.hpp> // Must come before posix_time.
  17. #include <boost/asio/detail/push_options.hpp>
  18. #include <boost/date_time/posix_time/posix_time_types.hpp>
  19. #include <boost/asio/detail/pop_options.hpp>
  20. #include <boost/asio/detail/noncopyable.hpp>
  21. namespace boost {
  22. namespace asio {
  23. namespace detail {
  24. class timer_queue_base
  25. : private noncopyable
  26. {
  27. public:
  28. // Destructor.
  29. virtual ~timer_queue_base() {}
  30. // Whether there are no timers in the queue.
  31. virtual bool empty() const = 0;
  32. // Get the time to wait until the next timer.
  33. virtual boost::posix_time::time_duration wait_duration() const = 0;
  34. // Dispatch all ready timers.
  35. virtual void dispatch_timers() = 0;
  36. // Dispatch any pending cancels for timers.
  37. virtual void dispatch_cancellations() = 0;
  38. // Complete all timers that are waiting to be completed.
  39. virtual void complete_timers() = 0;
  40. // Destroy all timers.
  41. virtual void destroy_timers() = 0;
  42. };
  43. } // namespace detail
  44. } // namespace asio
  45. } // namespace boost
  46. #include <boost/asio/detail/pop_options.hpp>
  47. #endif // BOOST_ASIO_DETAIL_TIMER_QUEUE_BASE_HPP