Develop Biology
The language of life
Macros.h File Reference
#include "AssertMacros.h"
#include "LanguageMacros.h"
#include "NumArgsMacros.h"
#include "OptimizeMacros.h"
#include "OSMacros.h"
#include "SanitizeMacros.h"
#include "StrongTypedef.h"
#include "bio/common/ByteStream.h"
+ Include dependency graph for Macros.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BIO_CALL_LOOP(loopName, iterations, ...)    loopName##_##iterations(__VA_ARGS__)
 
#define BIO_CALL_NS_MACRO(macroName, ns, ...)    macroName##_##ns(__VA_ARGS__)
 
#define BIO_DEFINE_MAP(mapName, keyType, valueType)
 
#define BIO_EXPAND_TUPLE(...)   __VA_ARGS__
 
#define BIO_SINGLE_ARG(...)   __VA_ARGS__
 
#define BIO_SINGLETON(className, baseClass)
 
#define BIO_WRAP_MACRO(macro)   macro
 

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.

Definition at line 85 of file Macros.h.

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

Definition at line 75 of file Macros.h.

◆ BIO_DEFINE_MAP

#define BIO_DEFINE_MAP (   mapName,
  keyType,
  valueType 
)
Value:
typedef std::map<keyType, valueType> mapName; \
typedef std::pair<keyType, valueType> mapName##Pair;

Create a consistent map and pair.

Definition at line 115 of file Macros.h.

◆ 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

Definition at line 49 of file Macros.h.

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

Definition at line 66 of file Macros.h.

◆ BIO_SINGLETON

#define BIO_SINGLETON (   className,
  baseClass 
)
Value:
class className : \
public baseClass \
{ \
public: \
static className& Instance() \
{ \
static className instance; \
return instance; \
} \
private: \
className() \
{ \
} \
className(className const &); \
void operator=(className const &); \
};

Singleton interface makes the constructor private so that there is only one instance ever created, which is by Instance() we also override default copy constructor and assignment operator so that nobody can make a copy of the singleton (otherwise it wouldn't be a singleton). We don't define them, so these methods will give a link error if used.

Parameters
classNamethe name of the new singleton
baseClassthe name of the class the new singleton will inherit from (i.e. what to make into a singleton).

Definition at line 94 of file Macros.h.

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

Definition at line 41 of file Macros.h.