Kea 3.1.4
interval_timer.h
Go to the documentation of this file.
1// Copyright (C) 2011-2025 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#ifdef __GNUC__
11#pragma GCC diagnostic push
12#pragma GCC diagnostic ignored "-Woverloaded-virtual"
13#endif
14#include <boost/asio/deadline_timer.hpp>
15#ifdef __GNUC__
16#pragma GCC diagnostic pop
17#endif
18
19#include <boost/shared_ptr.hpp>
20#include <functional>
21
22#include <asiolink/io_service.h>
23
24namespace isc {
25namespace asiolink {
26
28
61class IntervalTimer {
62public:
64 typedef std::function<void()> Callback;
65
69 enum Mode
70 {
73 };
74
80
81private:
82 IntervalTimer(const IntervalTimer& source);
83 IntervalTimer& operator=(const IntervalTimer& source);
84public:
92 IntervalTimer(const IOServicePtr& io_service);
93
102
122 void setup(const Callback& cbfunc, const long interval,
123 const Mode& mode = REPEATING);
124
133 void cancel();
134
141 long getInterval() const;
142
143private:
144 boost::shared_ptr<IntervalTimerImpl> impl_;
145};
146
147typedef boost::shared_ptr<isc::asiolink::IntervalTimer> IntervalTimerPtr;
148
149} // namespace asiolink
150} // namespace isc
151
152#endif // ASIOLINK_INTERVAL_TIMER_H
Defines the logger used by the top-level component of kea-lfc.