libbio
Loading...
Searching...
No Matches
Macros
Macros.h File Reference
#include "AssertMacros.h"
#include "LanguageMacros.h"
#include "NumArgsMacros.h"
#include "OptimizeMacros.h"
#include "OSMacros.h"
#include "SanitizeMacros.h"
#include "SingletonMacros.h"
#include "StrongTypedef.h"
#include "KeywordMacros.h"
#include "UtilityHelperMacros.h"
Include dependency graph for common/macro/Macros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BIO_WRAP_MACRO(macro)   macro
 
#define BIO_EXPAND_TUPLE(...)   __VA_ARGS__
 
#define BIO_SINGLE_ARG(...)   __VA_ARGS__
 
#define BIO_CALL_NS_MACRO(macroName, ns, ...)    macroName##_##ns(__VA_ARGS__)
 
#define BIO_CALL_LOOP(loopName, iterations, ...)    loopName##_##iterations(__VA_ARGS__)
 

Macro Definition Documentation

◆ BIO_CALL_LOOP

#define BIO_CALL_LOOP (   loopName,
  iterations,
  ... 
)     loopName##_##iterations(__VA_ARGS__)

Call a macro-based loop. These are hard-coded with a certain iteration count.
Expands loopName from something like MY_LOOP with iterations of, say, 5 to MY_LOOP_5(...). Requires that MY_LOOP_5 be implemented.

Parameters
loopNamethe base name of the macro to call
iterationsthe number of times to call the given macro
...all arguments to give to the loop, including iterations.

◆ BIO_CALL_NS_MACRO

#define BIO_CALL_NS_MACRO (   macroName,
  ns,
  ... 
)     macroName##_##ns(__VA_ARGS__)

Calls a namespaced macro.
NOTE: These deviate from the traditional naming scheme because namespaces are lowercase and, for ease of use, we will not require the namespace be written in both capitals and lower case.
Will expand MY_MACRO, cellular to MY_MACRO_cellular(...)

Parameters
macroNamethe name of the macro to call
nsthe namespace in which to call the macro.

◆ BIO_EXPAND_TUPLE

#define BIO_EXPAND_TUPLE (   ...)    __VA_ARGS__

Used to remove fhe parentheses from around an expression.
Should be invoked as: BIO_EXPAND_TUPLE tuple
where tuple is (something, like, this)
which expands to BIO_EXPAND_TUPLE (something, like, this) => something, like, this

◆ BIO_SINGLE_ARG

#define BIO_SINGLE_ARG (   ...)    __VA_ARGS__

Encapsulates an expression containing commas, allowing it to be safely passed as a single macro argument.
Should be invoked as:
SOME_OTHER_MACRO(
BIO_SINGLE_ARG(
something,
that,
would,
normally,
be,
many,
args
), whatever, other, arguments, are, needed)
While this is currently exactly the same as BIO_EXPAND_TUPLE, the use case is different, so duplicate code is maintained.

◆ BIO_WRAP_MACRO

#define BIO_WRAP_MACRO (   macro)    macro

This file contains all common preprocessor macros.
Additional macros may be specified in files they more specifically pertain to
All bio macros start with BIO_
Wrapping macros is used to evaluate them within other macros, rather than being passed as a string.