Kea  1.9.9-git
interval_timer.h
Go to the documentation of this file.
1 // Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef ASIOLINK_INTERVAL_TIMER_H
8 #define ASIOLINK_INTERVAL_TIMER_H 1
9 
10 #include <boost/shared_ptr.hpp>
11 #include <functional>
12 
13 #include <asiolink/io_service.h>
14 
15 namespace isc {
16 namespace asiolink {
17 
18 class IntervalTimerImpl;
19 
53 public:
55  typedef std::function<void()> Callback;
56 
60  enum Mode
61  {
64  };
65 
71 
72 private:
73  IntervalTimer(const IntervalTimer& source);
74  IntervalTimer& operator=(const IntervalTimer& source);
75 public:
83  IntervalTimer(IOService& io_service);
84 
93 
113  void setup(const Callback& cbfunc, const long interval,
114  const Mode& mode = REPEATING);
115 
124  void cancel();
125 
132  long getInterval() const;
133 
134 private:
135  boost::shared_ptr<IntervalTimerImpl> impl_;
136 };
137 
138 typedef boost::shared_ptr<isc::asiolink::IntervalTimer> IntervalTimerPtr;
139 
140 } // namespace asiolink
141 } // namespace isc
142 #endif // ASIOLINK_INTERVAL_TIMER_H
Defines the logger used by the top-level component of kea-dhcp-ddns.