Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
Registered-Callback List Storage Shape

Fixed-capacity {callback, context} list shape (ADR-030). More...

Macros

#define SAFEAPI_DECLARE_CALLBACK_LIST(list_type, callback_fn_type, max_subscribers)
 Declares a fixed-capacity list of {callback, context} slots for one concretely-typed callback function pointer - see this file's own header for the full usage pattern (init/register/ dispatch are hand-written against the declared type, not generated by this macro).

Detailed Description

Fixed-capacity {callback, context} list shape (ADR-030).

Macro Definition Documentation

◆ SAFEAPI_DECLARE_CALLBACK_LIST

#define SAFEAPI_DECLARE_CALLBACK_LIST ( list_type,
callback_fn_type,
max_subscribers )
Value:
typedef struct \
{ \
callback_fn_type fn; \
void *context; \
} list_type##_slot_t; \
typedef struct \
{ \
list_type##_slot_t slots[(max_subscribers)]; \
uint32_t count; \
} list_type

Declares a fixed-capacity list of {callback, context} slots for one concretely-typed callback function pointer - see this file's own header for the full usage pattern (init/register/ dispatch are hand-written against the declared type, not generated by this macro).

Parameters
list_typeName of the generated list type.
callback_fn_typeAn already-declared function pointer typedef (e.g. typedef bool (*my_fn)(void *, ...)).
max_subscribersFixed slot count (compile-time constant).

Usage: SAFEAPI_DECLARE_CALLBACK_LIST(my_validator_list_t, my_validator_fn, 2U);

Definition at line 136 of file sapi_notify.h.