Interfaces
Interfaces are a type of classifier that specify a contract consisting of a set of public services. An interface is a non-instantiable entity that is realized by a class, object, block, file and might be realized by any number of these entities.
In terms of C programming, an interface is represented by a set of global function declarations and a structure consisting of void pointers to the global virtual functions.
For
example, given some class B with the global
functions read()
and parse()
, there
exists an interface I_B with the following global declarations:
void I_B_parse(void * const void_me);
void I_B_read(void * const void_me);
and a structure as follows:
typedef struct I_B_Vtbl{
size_t I_B_offset;
RiCBoolean (*I_B_gen)(void * const void_me, RiCEvent* event,
RiCBoolean fromISR);
void (*I_B_parse)(void * const void_me);
void (*I_B_read)(void * const void_me);
} I_B_Vtbl;