|
MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
|
Utility for executing actions with a start and end function over a duration. More...
#include <Timers.hpp>
Collaboration diagram for MayaFlux::Kriya::TimedAction:Public Member Functions | |
| TimedAction (Vruta::TaskScheduler &scheduler) | |
| Constructs a TimedAction with the specified scheduler. | |
| ~TimedAction ()=default | |
| void | execute (std::function< void()> start_func, std::function< void()> end_func, double duration_seconds) |
| Executes a pair of functions with a time interval between them. | |
| void | cancel () |
| Cancels any active action. | |
| bool | is_pending () const |
| Checks if an action is currently in progress. | |
Private Attributes | |
| Vruta::TaskScheduler & | m_Scheduler |
| Reference to the scheduler that manages this action. | |
| Timer | m_timer |
| The timer used to schedule the end function. | |
Utility for executing actions with a start and end function over a duration.
The TimedAction class provides a way to execute a pair of functions with a specified time interval between them. This is useful for operations that need to start and then automatically stop after a duration, such as activating a process, applying a transformation, or implementing any time-bounded state change.
Example usage:
Only one action can be active at a time; executing a new action cancels any previously active action.
Definition at line 142 of file Timers.hpp.