KiCad PCB EDA Suite
Loading...
Searching...
No Matches
THROTTLE Class Reference

Rate-limiter that fires at most once per interval. More...

#include <throttle.h>

Public Member Functions

 THROTTLE (std::chrono::milliseconds aInterval)
 
bool Ready ()
 

Private Attributes

std::chrono::milliseconds m_interval
 
std::chrono::steady_clock::time_point m_last
 

Detailed Description

Rate-limiter that fires at most once per interval.

The first call to Ready() always returns true so callers can emit an initial update immediately.

Definition at line 34 of file throttle.h.

Constructor & Destructor Documentation

◆ THROTTLE()

THROTTLE::THROTTLE ( std::chrono::milliseconds aInterval)
inlineexplicit

Definition at line 37 of file throttle.h.

References m_interval, and m_last.

Member Function Documentation

◆ Ready()

bool THROTTLE::Ready ( )
inline
Returns
true when at least m_interval has elapsed since the previous true return (or since construction). Resets the internal clock on a true return.

Definition at line 48 of file throttle.h.

References m_interval, and m_last.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ALLEGRO::BOARD_BUILDER::BuildBoard(), ALLEGRO::PARSER::readObjects(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), and SYMBOL_EDIT_FRAME::SyncLibraries().

Member Data Documentation

◆ m_interval

std::chrono::milliseconds THROTTLE::m_interval
private

Definition at line 62 of file throttle.h.

Referenced by Ready(), and THROTTLE().

◆ m_last

std::chrono::steady_clock::time_point THROTTLE::m_last
private

Definition at line 63 of file throttle.h.

Referenced by Ready(), and THROTTLE().


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