|
RAVENNAKIT
|
A class that throttles a value to a given interval. More...
#include <throttle.hpp>
Public Member Functions | |
| Throttle ()=default | |
| Throttle (const std::chrono::milliseconds interval) | |
| Constructs the throttle with the given interval. | |
| void | set_interval (const std::chrono::milliseconds interval) |
| std::optional< T > | update (T value) |
| Updates the value and if the interval has passed since the last update returns the new value. | |
| std::optional< T > | get () |
| std::optional< T > | get_throttled () |
| void | clear () |
| Clears the stored value. | |
A class that throttles a value to a given interval.
| T | The type of the value to throttle. |
Definition at line 36 of file throttle.hpp.
|
default |
|
inlineexplicit |
Constructs the throttle with the given interval.
| interval | The interval to throttle the value to. |
Definition at line 44 of file throttle.hpp.
|
inline |
Clears the stored value.
Definition at line 89 of file throttle.hpp.
|
inline |
Definition at line 67 of file throttle.hpp.
|
inline |
Definition at line 75 of file throttle.hpp.
|
inline |
| interval | The interval to throttle the value to. |
Definition at line 49 of file throttle.hpp.
|
inline |
Updates the value and if the interval has passed since the last update returns the new value.
If the value is equal to the current value, nothing will happen and the function will return an empty optional.
| value | The new value. |
Definition at line 59 of file throttle.hpp.