libsapling  0.8.0
Macros
typed_adapters.h File Reference

Implementation of typed adapters for predicate and apply functions. More...

#include "libsapling/dm/graph.h"
#include "libsapling/dm/typed/typed_common.h"

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

Detailed Description

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.

Macro Definition Documentation

◆ CAST_USER_INFO

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

Parameters
TYPEType of the variable
VARName of the variable
INFOName of function parameter that points to the user information

◆ IMPLEMENT_TYPED_ADAPTERS

#define IMPLEMENT_TYPED_ADAPTERS (   SYM,
  TYPE,
  IMPL 
)

Pastes all definitions that implement typed adapters.

Attention
This macro is only intended to be used when defining a typed interface for a set implementation.
Parameters
SYMPrefix symbol for the adapter definitions
TYPEType with which the adapters will be dealing with
IMPLWhich set implementation's data will be accessed