ReXGlue SDK
Loading...
Searching...
No Matches
rex::platform::Timer Class Referenceabstract

#include <rex/platform/timer.h>

Inheritance diagram for rex::platform::Timer:
[legend]

Public Types

using WindowsClock = rex::WinSystemClock
using SteadyClock = std::chrono::steady_clock

Public Member Functions

virtual bool SetOnceAfter (rex::HundredNanoseconds rel_time, std::function< void()> opt_callback=nullptr)=0
virtual bool SetOnceAt (WindowsClock::time_point due_time, std::function< void()> opt_callback=nullptr)=0
virtual bool SetOnceAt (SteadyClock::time_point due_time, std::function< void()> opt_callback=nullptr)=0
virtual bool SetRepeatingAfter (rex::HundredNanoseconds rel_time, std::chrono::milliseconds period, std::function< void()> opt_callback=nullptr)=0
virtual bool SetRepeatingAt (WindowsClock::time_point due_time, std::chrono::milliseconds period, std::function< void()> opt_callback=nullptr)=0
virtual bool SetRepeatingAt (SteadyClock::time_point due_time, std::chrono::milliseconds period, std::function< void()> opt_callback=nullptr)=0
virtual bool Cancel ()=0
virtual bool Reset ()=0
Public Member Functions inherited from rex::platform::WaitHandle
virtual void * GetNativeHandle () const =0

Static Public Member Functions

static std::unique_ptr< Timer > CreateManualResetTimer ()
static std::unique_ptr< Timer > CreateSynchronizationTimer ()

Detailed Description

Waitable timer modeled on the Win32 waitable timer. The optional callback runs as a user callback on the thread that set the timer on Windows, and on the timer queue thread on POSIX.

Member Function Documentation

◆ Cancel()

virtual bool rex::platform::Timer::Cancel ( )
pure virtual

Stops the timer and discards pending callbacks. Waiting threads keep waiting and a signaled timer stays signaled.

◆ CreateManualResetTimer()

std::unique_ptr< Timer > rex::platform::Timer::CreateManualResetTimer ( )
static

Creates a timer that stays signaled until a Set call gives it a new due time.

Returns
The timer, or null on failure.

◆ CreateSynchronizationTimer()

std::unique_ptr< Timer > rex::platform::Timer::CreateSynchronizationTimer ( )
static

Creates a timer that resets after a wait on it completes.

Returns
The timer, or null on failure.

◆ Reset()

virtual bool rex::platform::Timer::Reset ( )
pure virtual

Stops the timer, discards pending callbacks and clears the signal.

◆ SetOnceAfter()

virtual bool rex::platform::Timer::SetOnceAfter ( rex::HundredNanoseconds rel_time,
std::function< void()> opt_callback = nullptr )
pure virtual

Arms the timer to fire once after a delay.

Parameters
opt_callbackFunction called when the timer fires, may be null.

◆ SetOnceAt() [1/2]

virtual bool rex::platform::Timer::SetOnceAt ( SteadyClock::time_point due_time,
std::function< void()> opt_callback = nullptr )
pure virtual

Arms the timer to fire once at a steady clock time.

Parameters
opt_callbackFunction called when the timer fires, may be null.

◆ SetOnceAt() [2/2]

virtual bool rex::platform::Timer::SetOnceAt ( WindowsClock::time_point due_time,
std::function< void()> opt_callback = nullptr )
pure virtual

Arms the timer to fire once at a Windows clock time.

Parameters
opt_callbackFunction called when the timer fires, may be null.

◆ SetRepeatingAfter()

virtual bool rex::platform::Timer::SetRepeatingAfter ( rex::HundredNanoseconds rel_time,
std::chrono::milliseconds period,
std::function< void()> opt_callback = nullptr )
pure virtual

Arms the timer to fire after a delay and then each period until Cancel or a new Set call.

Parameters
opt_callbackFunction called each time the timer fires, may be null.

◆ SetRepeatingAt() [1/2]

virtual bool rex::platform::Timer::SetRepeatingAt ( SteadyClock::time_point due_time,
std::chrono::milliseconds period,
std::function< void()> opt_callback = nullptr )
pure virtual

Arms the timer to fire at a steady clock time and then each period.

Parameters
opt_callbackFunction called each time the timer fires, may be null.

◆ SetRepeatingAt() [2/2]

virtual bool rex::platform::Timer::SetRepeatingAt ( WindowsClock::time_point due_time,
std::chrono::milliseconds period,
std::function< void()> opt_callback = nullptr )
pure virtual

Arms the timer to fire at a Windows clock time and then each period.

Parameters
opt_callbackFunction called each time the timer fires, may be null.

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