HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions
v1::function_timer Class Reference

#include <hikogui/dispatch/function_timer.hpp>

Public Member Functions

constexpr bool empty () const noexcept
 
template<forward_of< void()> Func>
std::pair< callback< void()>, bool > delay_function (utc_nanoseconds time_point, Func &&func) noexcept
 Add a function to be called at a certain time.
 
template<forward_of< void()> Func>
std::pair< callback< void()>, bool > repeat_function (std::chrono::nanoseconds period, utc_nanoseconds time_point, Func &&func) noexcept
 Add a function to be called repeatedly.
 
template<forward_of< void()> Func>
std::pair< callback< void()>, bool > repeat_function (std::chrono::nanoseconds period, Func &&func) noexcept
 Add a function to be called repeatedly.
 
utc_nanoseconds current_deadline () const noexcept
 Get the deadline of the next function to call.
 
void run_all (utc_nanoseconds current_time, auto const &...args) noexcept
 Run all the function that should have run by the current_time.
 

Detailed Description

A timer that calls functions.

Member Function Documentation

◆ current_deadline()

utc_nanoseconds v1::function_timer::current_deadline ( ) const
inlinenoexcept

Get the deadline of the next function to call.

Returns
The deadline of the next function to call, or far/max into the future.

◆ delay_function()

template<forward_of< void()> Func>
std::pair< callback< void()>, bool > v1::function_timer::delay_function ( utc_nanoseconds time_point,
Func && func )
inlinenoexcept

Add a function to be called at a certain time.

Parameters
time_pointThe time when to call the function.
callbackThe function to be called.
Returns
token, next to call.

◆ repeat_function() [1/2]

template<forward_of< void()> Func>
std::pair< callback< void()>, bool > v1::function_timer::repeat_function ( std::chrono::nanoseconds period,
Func && func )
inlinenoexcept

Add a function to be called repeatedly.

Parameters
periodThe period between repeated calls
callbackThe function to be called.
Returns
token, next to call.

◆ repeat_function() [2/2]

template<forward_of< void()> Func>
std::pair< callback< void()>, bool > v1::function_timer::repeat_function ( std::chrono::nanoseconds period,
utc_nanoseconds time_point,
Func && func )
inlinenoexcept

Add a function to be called repeatedly.

Parameters
periodThe period between repeated calls
time_pointThe time when to call the function the first time.
callbackThe function to be called.
Returns
token, next to call.

◆ run_all()

void v1::function_timer::run_all ( utc_nanoseconds current_time,
auto const &... args )
inlinenoexcept

Run all the function that should have run by the current_time.

Parameters
current_timeThe current time.
argsThe arguments to pass to the function.

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