LocalGuidance
A library that generates velocity references to follow a path.
macro_helpers.hpp File Reference
This graph shows which files directly or indirectly include this file:

Macros

#define FIRST(a, ...)   a
 
#define SECOND(a, b, ...)   b
 
#define EMPTY()
 
#define EVAL(...)   EVAL1024(__VA_ARGS__)
 
#define EVAL1024(...)   EVAL512(EVAL512(__VA_ARGS__))
 
#define EVAL512(...)   EVAL256(EVAL256(__VA_ARGS__))
 
#define EVAL256(...)   EVAL128(EVAL128(__VA_ARGS__))
 
#define EVAL128(...)   EVAL64(EVAL64(__VA_ARGS__))
 
#define EVAL64(...)   EVAL32(EVAL32(__VA_ARGS__))
 
#define EVAL32(...)   EVAL16(EVAL16(__VA_ARGS__))
 
#define EVAL16(...)   EVAL8(EVAL8(__VA_ARGS__))
 
#define EVAL8(...)   EVAL4(EVAL4(__VA_ARGS__))
 
#define EVAL4(...)   EVAL2(EVAL2(__VA_ARGS__))
 
#define EVAL2(...)   EVAL1(EVAL1(__VA_ARGS__))
 
#define EVAL1(...)   __VA_ARGS__
 
#define DEFER1(m)   m EMPTY()
 
#define DEFER2(m)   m EMPTY EMPTY()()
 
#define DEFER3(m)   m EMPTY EMPTY EMPTY()()()
 
#define DEFER4(m)   m EMPTY EMPTY EMPTY EMPTY()()()()
 
#define IS_PROBE(...)   SECOND(__VA_ARGS__, 0)
 
#define PROBE()   ~, 1
 
#define CAT(a, b)   a ## b
 
#define NOT(x)   IS_PROBE(CAT(_NOT_, x))
 
#define _NOT_0   PROBE()
 
#define BOOL(x)   NOT(NOT(x))
 
#define IF_ELSE(condition)   _IF_ELSE(BOOL(condition))
 
#define _IF_ELSE(condition)   CAT(_IF_, condition)
 
#define _IF_1(...)   __VA_ARGS__ _IF_1_ELSE
 
#define _IF_0(...)   _IF_0_ELSE
 
#define _IF_1_ELSE(...)
 
#define _IF_0_ELSE(...)   __VA_ARGS__
 
#define HAS_ARGS(...)   BOOL(FIRST(_END_OF_ARGUMENTS_ __VA_ARGS__)())
 
#define _END_OF_ARGUMENTS_()   0
 
#define MAP(m, first, ...)
 

Macro Definition Documentation

◆ _END_OF_ARGUMENTS_

#define _END_OF_ARGUMENTS_ ( )    0

◆ _IF_0

#define _IF_0 (   ...)    _IF_0_ELSE

◆ _IF_0_ELSE

#define _IF_0_ELSE (   ...)    __VA_ARGS__

◆ _IF_1

#define _IF_1 (   ...)    __VA_ARGS__ _IF_1_ELSE

◆ _IF_1_ELSE

#define _IF_1_ELSE (   ...)

◆ _IF_ELSE

#define _IF_ELSE (   condition)    CAT(_IF_, condition)

◆ _NOT_0

#define _NOT_0   PROBE()

◆ BOOL

#define BOOL (   x)    NOT(NOT(x))

◆ CAT

#define CAT (   a,
 
)    a ## b

◆ DEFER1

#define DEFER1 (   m)    m EMPTY()

◆ DEFER2

#define DEFER2 (   m)    m EMPTY EMPTY()()

◆ DEFER3

#define DEFER3 (   m)    m EMPTY EMPTY EMPTY()()()

◆ DEFER4

#define DEFER4 (   m)    m EMPTY EMPTY EMPTY EMPTY()()()()

◆ EMPTY

#define EMPTY ( )

◆ EVAL

#define EVAL (   ...)    EVAL1024(__VA_ARGS__)

◆ EVAL1

#define EVAL1 (   ...)    __VA_ARGS__

◆ EVAL1024

#define EVAL1024 (   ...)    EVAL512(EVAL512(__VA_ARGS__))

◆ EVAL128

#define EVAL128 (   ...)    EVAL64(EVAL64(__VA_ARGS__))

◆ EVAL16

#define EVAL16 (   ...)    EVAL8(EVAL8(__VA_ARGS__))

◆ EVAL2

#define EVAL2 (   ...)    EVAL1(EVAL1(__VA_ARGS__))

◆ EVAL256

#define EVAL256 (   ...)    EVAL128(EVAL128(__VA_ARGS__))

◆ EVAL32

#define EVAL32 (   ...)    EVAL16(EVAL16(__VA_ARGS__))

◆ EVAL4

#define EVAL4 (   ...)    EVAL2(EVAL2(__VA_ARGS__))

◆ EVAL512

#define EVAL512 (   ...)    EVAL256(EVAL256(__VA_ARGS__))

◆ EVAL64

#define EVAL64 (   ...)    EVAL32(EVAL32(__VA_ARGS__))

◆ EVAL8

#define EVAL8 (   ...)    EVAL4(EVAL4(__VA_ARGS__))

◆ FIRST

#define FIRST (   a,
  ... 
)    a

◆ HAS_ARGS

#define HAS_ARGS (   ...)    BOOL(FIRST(_END_OF_ARGUMENTS_ __VA_ARGS__)())

◆ IF_ELSE

#define IF_ELSE (   condition)    _IF_ELSE(BOOL(condition))

◆ IS_PROBE

#define IS_PROBE (   ...)    SECOND(__VA_ARGS__, 0)

◆ MAP

#define MAP (   m,
  first,
  ... 
)
Value:
m(first) \
IF_ELSE(HAS_ARGS(__VA_ARGS__))( \
DEFER2(_MAP)()(m, __VA_ARGS__) \
)( \
/* Do nothing, just terminate */ \
)
#define HAS_ARGS(...)
Definition: macro_helpers.hpp:45

◆ NOT

#define NOT (   x)    IS_PROBE(CAT(_NOT_, x))

◆ PROBE

#define PROBE ( )    ~, 1

◆ SECOND

#define SECOND (   a,
  b,
  ... 
)    b