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