SGL
gtimer.h
1 /*
2  * File: gtimer.h
3  * --------------
4  * This file defines the <code>GTimer</code> class, which implements a
5  * general interval timer.
6  *
7  * @version 2019/01/23
8  * - added destructor
9  * @version 2018/09/09
10  * - updated to use new Qt GUI timer interface
11  * - added doc comments for new documentation generation
12  */
13 
14 
15 #ifndef _gtimer_h
16 #define _gtimer_h
17 
18 #include <string>
19 
24 class GTimer {
25 public:
37  GTimer(double milliseconds);
38 
42  ~GTimer();
43 
47  double getDelay() const;
48 
57  bool isStarted() const;
58 
62  void restart();
63 
71  void setDelay(double ms);
72 
79  void start();
80 
84  void stop();
85 
86 private:
87  double _ms;
88  int _id;
89 };
90 
91 #endif // _gtimer_h
double getDelay() const
Returns the delay in milliseconds between each tick of this timer.
Definition: gtimer.cpp:34
void start()
Starts the timer.
Definition: gtimer.cpp:55
void stop()
Stops the timer so that it stops generating events until it is restarted.
Definition: gtimer.cpp:66
void setDelay(double ms)
Changes the delay in milliseconds between each tick of this timer.
Definition: gtimer.cpp:47
void restart()
Stops the timer (if it was started) and then starts it again.
Definition: gtimer.cpp:42
This class implements a simple interval timer that generates a GTimerEvent with a specified frequency...
Definition: gtimer.h:24
GTimer(double milliseconds)
Creates a timer object that generates a GTimerEvent each time the specified number of milliseconds ha...
Definition: gtimer.cpp:24
~GTimer()
Destroys the timer, stopping it if it&#39;s currently running.
Definition: gtimer.cpp:30
bool isStarted() const
Method: isStarted Usage: if (timer.isStarted()) { ...
Definition: gtimer.cpp:38