VSF Documented
|
#include "./delegate.h"
Macros | |
#define | __VSF_DELEGATE_CLASS_IMPLEMENT |
#define | EVENT_RT_UNREGISTER 4 |
#define | vsf_this (*this_ptr) |
#define | RAISE_EVENT_START 0 |
#define | RAISE_EVENT_CHECK_HANDLER 1 |
#define | RAISE_EVENT_RUN_HANDLER 2 |
#define | RAISE_EVENT_RESET_FSM() do { vsf_this.chState = 0; } while (0) |
Functions | |
delegate_t * | delegate_init (delegate_t *event_ptr) |
initialize event ! | |
delegate_handler_t * | delegate_handler_init (delegate_handler_t *handler_ptr, delegate_handler_func_t *routine_fn, void *arg_ptr) |
initialize event handler item ! | |
vsf_err_t | register_delegate_handler (delegate_t *event_ptr, delegate_handler_t *handler_ptr) |
register event handler to specified event ! | |
vsf_err_t | unregister_delegate_handler (delegate_t *event_ptr, delegate_handler_t *handler_ptr) |
unregister a specified event handler ! | |
fsm_rt_t | invoke_delegate (delegate_t *event_ptr, void *param_ptr) |
raise target event ! | |
#define __VSF_DELEGATE_CLASS_IMPLEMENT |
#define EVENT_RT_UNREGISTER 4 |
#define vsf_this (*this_ptr) |
#define RAISE_EVENT_START 0 |
#define RAISE_EVENT_CHECK_HANDLER 1 |
#define RAISE_EVENT_RUN_HANDLER 2 |
#define RAISE_EVENT_RESET_FSM | ( | ) | do { vsf_this.chState = 0; } while (0) |
delegate_t * delegate_init | ( | delegate_t * | event_ptr | ) |
initialize event !
event_ptr | target event ! |
delegate_handler_t * delegate_handler_init | ( | delegate_handler_t * | handler_ptr, |
delegate_handler_func_t * | routine_fn, | ||
void * | arg_ptr | ||
) |
initialize event handler item !
handler_ptr | the target event handler item ! |
routine_fn | event handler routine ! |
arg_ptr | handler extra arguments ! |
vsf_err_t register_delegate_handler | ( | delegate_t * | event_ptr, |
delegate_handler_t * | handler_ptr | ||
) |
register event handler to specified event !
event_ptr | target event ! |
handler_ptr | target event handler ! |
search ready list
safe to remove
add handler to the ready list
vsf_err_t unregister_delegate_handler | ( | delegate_t * | event_ptr, |
delegate_handler_t * | handler_ptr | ||
) |
unregister a specified event handler !
event_ptr | target event ! |
handler_ptr | target event handler ! |
search ready list
safe to remove
search ready list
safe to remove
fsm_rt_t invoke_delegate | ( | delegate_t * | event_ptr, |
void * | param_ptr | ||
) |
raise target event !
event_ptr | the target event ! |
param_ptr | event parameter ! |
nothing to do
initialize state
finish visiting the ready list
complete
run the event handler
< get next item
return EVENT_RT_UNREGISTER means event handler could be removed