nngn
Loading...
Searching...
No Matches
nngn::Schedule Class Reference

Executor of deferred and recurrent tasks. More...

#include <schedule.h>

Collaboration diagram for nngn::Schedule:

Classes

struct  BaseEntry
 
struct  Entry
 
struct  TimeEntry
 

Public Types

enum  Flag : u8 {
  NONE , IGNORE_FAILURES = 1u << 0 , HEARTBEAT = 1u << 1 , NONE ,
  IGNORE_FAILURES = 1u << 0 , HEARTBEAT = 1u << 1
}
 
enum  Flag : u8 {
  NONE , IGNORE_FAILURES = 1u << 0 , HEARTBEAT = 1u << 1 , NONE ,
  IGNORE_FAILURES = 1u << 0 , HEARTBEAT = 1u << 1
}
 
using Fn = bool(*)(void *)
 Signature for task functions.
 
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)
 
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)
 
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< TimeEntryv = {}
 
std::vector< BaseEntryatexit_v = {}
 
u32 cur_gen = 0
 
const Timingtiming = nullptr
 

Detailed Description

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).

Member Typedef Documentation

◆ Fn [1/2]

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.

◆ Fn [2/2]

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.

Member Enumeration Documentation

◆ Flag [1/2]

Enumerator
NONE 
IGNORE_FAILURES 

Whether a failure in the task is critical or can be tolerated.

HEARTBEAT 

After it is triggered, execute again at every frame.

NONE 
IGNORE_FAILURES 

Whether a failure in the task is critical or can be tolerated.

HEARTBEAT 

After it is triggered, execute again at every frame.

◆ Flag [2/2]

Enumerator
NONE 
IGNORE_FAILURES 

Whether a failure in the task is critical or can be tolerated.

HEARTBEAT 

After it is triggered, execute again at every frame.

NONE 
IGNORE_FAILURES 

Whether a failure in the task is critical or can be tolerated.

HEARTBEAT 

After it is triggered, execute again at every frame.

Member Function Documentation

◆ add() [1/2]

template<typename T >
std::size_t nngn::Schedule::add ( std::vector< T > *  v,
T  t 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add() [2/2]

template<typename T >
std::size_t nngn::Schedule::add ( std::vector< T > *  v,
T  t 
)
private

◆ at() [1/2]

std::size_t nngn::Schedule::at ( Timing::time_point  t,
Entry  e 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ at() [2/2]

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

◆ atexit() [1/2]

std::size_t nngn::Schedule::atexit ( Entry  e)
Here is the call graph for this function:

◆ atexit() [2/2]

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

◆ cancel() [1/2]

bool nngn::Schedule::cancel ( std::size_t  i)
Here is the call graph for this function:

◆ cancel() [2/2]

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

◆ cancel_atexit() [1/2]

bool nngn::Schedule::cancel_atexit ( std::size_t  i)
Here is the call graph for this function:

◆ cancel_atexit() [2/2]

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

◆ cancel_common() [1/2]

template<typename T >
bool nngn::Schedule::cancel_common ( std::vector< T > *  v,
std::size_t  i 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancel_common() [2/2]

template<typename T >
bool nngn::Schedule::cancel_common ( std::vector< T > *  v,
std::size_t  i 
)
private

◆ exit() [1/2]

bool nngn::Schedule::exit ( void  )
Here is the call graph for this function:

◆ exit() [2/2]

bool nngn::Schedule::exit ( void  )

◆ frame() [1/2]

std::size_t nngn::Schedule::frame ( u64  f,
Entry  e 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ frame() [2/2]

std::size_t nngn::Schedule::frame ( u64  f,
Entry  e 
)

◆ in() [1/2]

std::size_t nngn::Schedule::in ( std::chrono::milliseconds  t,
Entry  e 
)
Here is the call graph for this function:

◆ in() [2/2]

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

◆ init() [1/2]

void nngn::Schedule::init ( const Timing t)
inline

◆ init() [2/2]

void nngn::Schedule::init ( const Timing t)
inline

◆ n() [1/2]

std::size_t nngn::Schedule::n ( void  ) const
inline

◆ n() [2/2]

std::size_t nngn::Schedule::n ( void  ) const
inline

◆ n_atexit() [1/2]

std::size_t nngn::Schedule::n_atexit ( void  ) const
inline

◆ n_atexit() [2/2]

std::size_t nngn::Schedule::n_atexit ( void  ) const
inline

◆ next() [1/2]

std::size_t nngn::Schedule::next ( Entry  e)
Here is the call graph for this function:

◆ next() [2/2]

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

◆ update() [1/2]

bool nngn::Schedule::update ( void  )
Here is the call graph for this function:

◆ update() [2/2]

bool nngn::Schedule::update ( void  )

Member Data Documentation

◆ atexit_v

std::vector< BaseEntry > nngn::Schedule::atexit_v = {}
private

◆ cur_gen

u32 nngn::Schedule::cur_gen = 0
private

◆ timing

const Timing * nngn::Schedule::timing = nullptr
private

◆ v

std::vector< TimeEntry > nngn::Schedule::v = {}
private

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