Realistic 3D camera system
3D camera system components
timer_queue_ptime.hpp
Go to the documentation of this file.
1 //
2 // detail/timer_queue_ptime.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 ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP
12 #define ASIO_DETAIL_TIMER_QUEUE_PTIME_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/time_traits.hpp"
20 
22 
23 #if defined(ASIO_HAS_BOOST_DATE_TIME)
24 
25 namespace asio {
26 namespace detail {
27 
28 struct forwarding_posix_time_traits : time_traits<boost::posix_time::ptime> {};
29 
30 // Template specialisation for the commonly used instantation.
31 template <>
32 class timer_queue<time_traits<boost::posix_time::ptime> >
33  : public timer_queue_base
34 {
35 public:
36  // The time type.
37  typedef boost::posix_time::ptime time_type;
38 
39  // The duration type.
40  typedef boost::posix_time::time_duration duration_type;
41 
42  // Per-timer data.
43  typedef timer_queue<forwarding_posix_time_traits>::per_timer_data
44  per_timer_data;
45 
46  // Constructor.
47  ASIO_DECL timer_queue();
48 
49  // Destructor.
50  ASIO_DECL virtual ~timer_queue();
51 
52  // Add a new timer to the queue. Returns true if this is the timer that is
53  // earliest in the queue, in which case the reactor's event demultiplexing
54  // function call may need to be interrupted and restarted.
55  ASIO_DECL bool enqueue_timer(const time_type& time,
56  per_timer_data& timer, wait_op* op);
57 
58  // Whether there are no timers in the queue.
59  ASIO_DECL virtual bool empty() const;
60 
61  // Get the time for the timer that is earliest in the queue.
62  ASIO_DECL virtual long wait_duration_msec(long max_duration) const;
63 
64  // Get the time for the timer that is earliest in the queue.
65  ASIO_DECL virtual long wait_duration_usec(long max_duration) const;
66 
67  // Dequeue all timers not later than the current time.
68  ASIO_DECL virtual void get_ready_timers(op_queue<operation>& ops);
69 
70  // Dequeue all timers.
71  ASIO_DECL virtual void get_all_timers(op_queue<operation>& ops);
72 
73  // Cancel and dequeue operations for the given timer.
74  ASIO_DECL std::size_t cancel_timer(
75  per_timer_data& timer, op_queue<operation>& ops,
76  std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)());
77 
78 private:
79  timer_queue<forwarding_posix_time_traits> impl_;
80 };
81 
82 } // namespace detail
83 } // namespace asio
84 
85 #endif // defined(ASIO_HAS_BOOST_DATE_TIME)
86 
88 
89 #if defined(ASIO_HEADER_ONLY)
91 #endif // defined(ASIO_HEADER_ONLY)
92 
93 #endif // ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP
#define ASIO_DECL
Definition: config.hpp:43