libsapling
0.8.0
|
Implementation of typed adapters for predicate and apply functions. More...
Go to the source code of this file.
Macros | |
#define | CAST_USER_INFO(TYPE, VAR, INFO) TYPE VAR = ((struct info_insert *)INFO)->info |
Creates a variable of the specified type with the user information proper. More... | |
#define | IMPLEMENT_TYPED_ADAPTERS(SYM, TYPE, IMPL) |
Pastes all definitions that implement typed adapters. More... | |
Implementation of typed adapters for predicate and apply functions.
Adapters allow predicates and apply functions to be defined without having to expose the node and the implementation information. Adapters provide these predicate and apply functions with a pointer to node's data cast to the appropiate type and the pointer to the user information directly, instead of providing a pointer to the node and the information stack proper. This reduces the number of casts the user has to write when writing a predicate or an apply function.
#define CAST_USER_INFO | ( | TYPE, | |
VAR, | |||
INFO | |||
) | TYPE VAR = ((struct info_insert *)INFO)->info |
Creates a variable of the specified type with the user information proper.
TYPE | Type of the variable |
VAR | Name of the variable |
INFO | Name of function parameter that points to the user information |
#define IMPLEMENT_TYPED_ADAPTERS | ( | SYM, | |
TYPE, | |||
IMPL | |||
) |
Pastes all definitions that implement typed adapters.
SYM | Prefix symbol for the adapter definitions |
TYPE | Type with which the adapters will be dealing with |
IMPL | Which set implementation's data will be accessed |