GEDLIB  1.0
timer.hpp
Go to the documentation of this file.
1 /***************************************************************************
2 * *
3 * Copyright (C) 2018 by David B. Blumenthal *
4 * *
5 * This file is part of GEDLIB. *
6 * *
7 * GEDLIB is free software: you can redistribute it and/or modify it *
8 * under the terms of the GNU Lesser General Public License as published *
9 * by the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * GEDLIB is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU Lesser General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License along with GEDLIB. If not, see <http://www.gnu.org/licenses/>. *
19 * *
20 ***************************************************************************/
21 
27 #ifndef SRC_ENV_TIMER_HPP_
28 #define SRC_ENV_TIMER_HPP_
29 
30 #include <iostream>
31 #include <chrono>
32 
33 namespace ged {
34 
38 class Timer {
39 public:
40 
45  Timer(double time_limit_in_sec);
46 
51  bool expired() const;
52 
53 private:
54 
55  const double time_limit_in_sec_;
56 
57  const std::chrono::high_resolution_clock::time_point start_time_;
58 };
59 
60 }
61 
62 #include "timer.ipp"
63 
64 #endif /* SRC_ENV_TIMER_HPP_ */
A timer class that can be used by methods that support time limits.
Definition: timer.hpp:38
bool expired() const
Checks if the time limit has expired.
Definition: timer.ipp:39
Timer(double time_limit_in_sec)
Constructs a timer for a given time limit.
Definition: timer.ipp:33
ged::Timer class definition.
Global namespace for GEDLIB.