Fawkes API  Fawkes Development Version
wait.h
1 
2 /***************************************************************************
3  * wait.h - TimeWait tool
4  *
5  * Created: Thu Nov 29 17:28:46 2007
6  * Copyright 2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _UTILS_TIME_WAIT_H_
25 #define _UTILS_TIME_WAIT_H_
26 
27 namespace fawkes {
28 
29 class Clock;
30 class Time;
31 
32 class TimeWait
33 {
34 public:
35  TimeWait(Clock *clock, long int desired_loop_time_usec);
36  ~TimeWait();
37 
38  void mark_start();
39  void wait();
40  void wait_systime();
41 
42  static void wait(long int usec);
43  static void wait_systime(long int usec);
44 
45 private:
46  Clock * clock_;
47  Time * until_;
48  Time * until_systime_;
49  Time * now_;
50  long int desired_loop_time_;
51 };
52 
53 } // end namespace fawkes
54 
55 #endif
fawkes::TimeWait::TimeWait
TimeWait(Clock *clock, long int desired_loop_time_usec)
Constructor.
Definition: wait.cpp:49
fawkes::TimeWait::wait
void wait()
Wait until minimum loop time has been reached.
Definition: wait.cpp:78
fawkes
Fawkes library namespace.
fawkes::TimeWait::mark_start
void mark_start()
Mark start of loop.
Definition: wait.cpp:68
fawkes::Time
A class for handling time.
Definition: time.h:93
fawkes::TimeWait
Time wait utility.
Definition: wait.h:33
fawkes::TimeWait::wait_systime
void wait_systime()
Wait until minimum loop time has been reached in real time.
Definition: wait.cpp:96
fawkes::TimeWait::~TimeWait
~TimeWait()
Destructor.
Definition: wait.cpp:59
fawkes::Clock
This is supposed to be the central clock in Fawkes.
Definition: clock.h:35