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