|
|
lucid
0.0.1
Lifting-based Uncertain Control Invariant Dynamics
|
The TimeGuard wraps a timer object and pauses it when the guard object is destructed. More...
#include <Timer.h>
Public Member Functions | |
| TimerGuard (T *timer, bool start_timer=true) | |
| Construct a new TimeGuard object. | |
| ~TimerGuard () | |
| When the timer guard object is destructed, it pauses the embedded timer object. | |
| void | pause () |
| Pause the guarded timer object if the timer is not a nullptr. | |
| void | resume () |
| Resume the guarded timer object if the timer is not a nullptr. | |
Private Attributes | |
| T *const | timer_ |
| The timer to be guarded. | |
The TimeGuard wraps a timer object and pauses it when the guard object is destructed.
Useful for measuring the exact time spent in a block of code.
|
explicit |
Construct a new TimeGuard object.
If timer is a nullptr, the guard will not do anything. If start_timer is true, the timer starts as soon as the guard is constructed. Otherwise, the method resume has to be called manually to start the timer.
| timer | a pointer to the timer object to be guarded. Must remain valid for the lifetime of the guard |
| start_timer | whether the timer should be started as soon as the guard is created |
| lucid::TimerGuard< T >::~TimerGuard | ( | ) |
When the timer guard object is destructed, it pauses the embedded timer object.
If the timer is a nullptr, this does nothing.