PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
profinet::MaxTimeout Class Reference

Time-limited-operation helper. More...

#include <util.h>

+ Collaboration diagram for profinet::MaxTimeout:

Public Member Functions

 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.
 

Private Attributes

std::chrono::steady_clock::time_point dieAfter
 Time point at which TimedOut() will start returning true.
 

Detailed Description

Time-limited-operation helper.

Example:

MaxTimeout timer(std::chrono::seconds(10));
while (!timer.TimedOut()) { ... }
Time-limited-operation helper.
Definition util.h:267
asio::steady_timer timer

Definition at line 266 of file util.h.

Constructor & Destructor Documentation

◆ MaxTimeout()

profinet::MaxTimeout::MaxTimeout ( std::chrono::duration< double >  seconds)
inlineexplicit

Start a countdown of the given duration.

Parameters
secondsHow long until TimedOut() returns true.

Definition at line 271 of file util.h.

Member Function Documentation

◆ 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).
Examples
/home/runner/work/rhmarine-oefenen/rhmarine-oefenen/profinet-io-controller-stack/include/profinet/util.h.

Definition at line 286 of file util.h.

References dieAfter.

Referenced by TEST_F(), and TEST_F().

+ Here is the caller graph for this function:

◆ TimedOut()

bool profinet::MaxTimeout::TimedOut ( ) const
inline

Whether the countdown has elapsed.

Returns
True if the configured duration has passed since construction.
Examples
/home/runner/work/rhmarine-oefenen/rhmarine-oefenen/profinet-io-controller-stack/include/profinet/util.h.

Definition at line 279 of file util.h.

References dieAfter.

Referenced by profinet::TEST(), TEST_F(), TEST_F(), and TEST_F().

+ Here is the caller graph for this function:

Member Data Documentation

◆ dieAfter

std::chrono::steady_clock::time_point profinet::MaxTimeout::dieAfter
private

Time point at which TimedOut() will start returning true.

Examples
/home/runner/work/rhmarine-oefenen/rhmarine-oefenen/profinet-io-controller-stack/include/profinet/util.h.

Definition at line 295 of file util.h.

Referenced by Remaining(), and TimedOut().


The documentation for this class was generated from the following file: