Time-limited-operation helper, mirroring util.py's MaxTimeout context manager.
More...
#include <util.h>
|
| | MaxTimeout (std::chrono::duration< double > seconds) |
| | Start a countdown of the given duration.
|
| |
| bool | TimedOut () const |
| | Whether the countdown has elapsed.
|
| |
| std::chrono::duration< double > | Remaining () const |
| | Time left before the countdown elapses.
|
| |
|
| std::chrono::steady_clock::time_point | dieAfter |
| | Time point at which TimedOut() will start returning true.
|
| |
Time-limited-operation helper, mirroring util.py's MaxTimeout context manager.
Example:
while (!timer.TimedOut()) { ... }
Time-limited-operation helper, mirroring util.py's MaxTimeout context manager.
Definition at line 318 of file util.h.
◆ MaxTimeout()
| profinet::MaxTimeout::MaxTimeout |
( |
std::chrono::duration< double > |
seconds | ) |
|
|
inlineexplicit |
Start a countdown of the given duration.
- Parameters
-
Definition at line 323 of file util.h.
◆ Remaining()
| std::chrono::duration< double > profinet::MaxTimeout::Remaining |
( |
| ) |
const |
|
inline |
Time left before the countdown elapses.
- Returns
- The remaining duration, clamped to zero (never negative).
Definition at line 338 of file util.h.
References dieAfter.
◆ TimedOut()
| bool profinet::MaxTimeout::TimedOut |
( |
| ) |
const |
|
inline |
Whether the countdown has elapsed.
- Returns
- True if the configured duration has passed since construction.
Definition at line 331 of file util.h.
References dieAfter.
◆ dieAfter
| std::chrono::steady_clock::time_point profinet::MaxTimeout::dieAfter |
|
private |
The documentation for this class was generated from the following file: