|
nngn
|
Executor of deferred and recurrent tasks. More...
#include <schedule.h>

Classes | |
| struct | BaseEntry |
| struct | Entry |
| struct | TimeEntry |
Public Types | |
| enum | Flag : u8 { NONE , IGNORE_FAILURES = 1u << 0 , HEARTBEAT = 1u << 1 } |
| using | Fn = bool(*)(void*) |
| Signature for task functions. | |
Public Member Functions | |
| void | init (const Timing *t) |
| std::size_t | n (void) const |
| std::size_t | n_atexit (void) const |
| std::size_t | next (Entry e) |
| std::size_t | frame (u64 f, Entry e) |
| std::size_t | in (std::chrono::milliseconds t, Entry e) |
| std::size_t | at (Timing::time_point t, Entry e) |
| std::size_t | atexit (Entry e) |
| bool | cancel (std::size_t i) |
| bool | cancel_atexit (std::size_t i) |
| bool | update (void) |
| bool | exit (void) |
Private Member Functions | |
| template<typename T > | |
| std::size_t | add (std::vector< T > *v, T t) |
| template<typename T > | |
| bool | cancel_common (std::vector< T > *v, std::size_t i) |
Private Attributes | |
| std::vector< TimeEntry > | v = {} |
| std::vector< BaseEntry > | atexit_v = {} |
| u32 | cur_gen = 0 |
| const Timing * | timing = nullptr |
Executor of deferred and recurrent tasks.
Tasks can be scheduled on a given frame (next, frame), at a given time (in, at), or a combination of those (execution happens at the first occurrence of either). A separate category exists for tasks that should be executed when the application terminates (atexit).
| using nngn::Schedule::Fn = bool(*)(void*) |
Signature for task functions.
The single parameter is a pointer to the data associated with the task on construction. true should be returned on success.
| enum nngn::Schedule::Flag : u8 |


| std::size_t nngn::Schedule::at | ( | Timing::time_point | t, |
| Entry | e ) |


| std::size_t nngn::Schedule::atexit | ( | Entry | e | ) |

| bool nngn::Schedule::cancel | ( | std::size_t | i | ) |

| bool nngn::Schedule::cancel_atexit | ( | std::size_t | i | ) |

|
private |


| bool nngn::Schedule::exit | ( | void | ) |



| std::size_t nngn::Schedule::in | ( | std::chrono::milliseconds | t, |
| Entry | e ) |

|
inline |
|
inline |
| std::size_t nngn::Schedule::next | ( | Entry | e | ) |


| bool nngn::Schedule::update | ( | void | ) |

|
private |
|
private |
|
private |