![]() |
NDEVR
API Documentation
|
Throttles the frequency of an action by enforcing a minimum time interval between firings. More...
Public Member Functions | |
| RateLimiter (fltp08 seconds) | |
| Constructs a RateLimiter with the specified minimum interval between firings. | |
| void | setCurrent (Time time) |
| Sets the current reference time, resetting the rate limiter period. | |
| bool | shouldFire (Time time, bool update_for_next_period=true) |
| Checks whether enough time has elapsed to allow the action to fire. | |
Protected Attributes | |
| TimeSpan | m_update_period |
| The time span defining the minimum interval between firings. | |
Throttles the frequency of an action by enforcing a minimum time interval between firings.
Definition at line 9 of file RateLimiter.h.
|
inline |
Constructs a RateLimiter with the specified minimum interval between firings.
| [in] | seconds | The minimum number of seconds that must elapse between firings. |
Definition at line 16 of file RateLimiter.h.
References m_update_period.
|
inline |
Sets the current reference time, resetting the rate limiter period.
| [in] | time | The new reference time to start the period from. |
Definition at line 23 of file RateLimiter.h.
References m_update_period.
|
inline |
Checks whether enough time has elapsed to allow the action to fire.
| [in] | time | The current time to check against the rate limit period. |
| [in] | update_for_next_period | Whether to reset the period start time when firing occurs. |
Definition at line 33 of file RateLimiter.h.
References m_update_period.