DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
macro.hpp File Reference
#include "dbe/convenience.hpp"
#include <string>
Include dependency graph for macro.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HERE_TMPL_DEF(T, funname)
#define HERE_AUTO_DEF(funname)
#define HERE_DEF(cn, fn)
#define HERE_FUN_DEF(fn)
#define ERROR_NOREL(MSG)
#define WARN_NOREL(MSG)
#define INFO_NOREL(MSG)
#define DEBUG_NOREL(MSG)
#define CONDITION_STD_SET(cond, lock, var, val)
#define CONDITION_BOOL_WAIT(cond, lock, var)
#define CONDITION_BOOL_WAIT_TRYFUN(cond, lock, var, tryfun)
#define CONDITION_BOOL_WAIT_FUN(cond, lock, fun)
#define CONDITION_BOOL_WAIT_FUN_TRYFUN(cond, lock, fun, tryfun)
#define DECLTYPE(x)
#define CAT(A, B)
#define SELECT(NAME, NUM)
#define GET_COUNT(_1, _2, _3, _4, _5, _6, _7, _8, _9, COUNT, ...)
#define VA_SIZE(...)
#define VA_SELECT(NAME, ...)

Macro Definition Documentation

◆ CAT

#define CAT ( A,
B )
Value:
A##B

Definition at line 156 of file macro.hpp.

◆ CONDITION_BOOL_WAIT

#define CONDITION_BOOL_WAIT ( cond,
lock,
var )
Value:
\
std::unique_lock<std::mutex> __LUTILS_CONDITIONAL_BOOL_WAIT_GUARD_##cond_##lock_##var__(lock); \
try { \
cond.wait(__LUTILS_CONDITIONAL_BOOL_WAIT_GUARD_##cond_##lock_##var__, [this]() { return var; }); \
} catch (...) { \
break; \
}

CONDITION_BOOL_WAIT provides safe concurrent wait on a shared variable

Upon any exception thrown it will break an enclosing loop

Definition at line 91 of file macro.hpp.

◆ CONDITION_BOOL_WAIT_FUN

#define CONDITION_BOOL_WAIT_FUN ( cond,
lock,
fun )
Value:
\
std::unique_lock<std::mutex> __LUTILS_CONDITIONAL_BOOL_WAIT_FUN_GUARD_##cond_##lock_(lock); \
try { \
cond.wait(__LUTILS_CONDITIONAL_BOOL_WAIT_FUN_GUARD_##cond_##lock_, fun); \
} catch (...) { \
break; \
}

CONDITION_BOOL_WAIT_FUN provides safe concurrent waiting on a shared variable, which is exposed through a function (fun)

Upon any exception thrown it will break an enclosing loop

Definition at line 121 of file macro.hpp.

◆ CONDITION_BOOL_WAIT_FUN_TRYFUN

#define CONDITION_BOOL_WAIT_FUN_TRYFUN ( cond,
lock,
fun,
tryfun )
Value:
\
std::unique_lock<std::mutex> __LUTILS_CONDITIONAL_BOOL_WAIT_FUN_TRYFUN_GUARD_##cond_##lock_(lock); \
try { \
cond.wait(__LUTILS_CONDITIONAL_BOOL_WAIT_FUN_TRYFUN_GUARD_##cond_##lock_, fun); \
} catch (...) { \
tryfun(); \
} \

CONDITION_BOOL_WAIT_FUN_TRYFUN provides safe concurrent waiting on a shared variable, which is exposed through a function (fun)

It is advisable that tryfun does not throw exceptions

Definition at line 136 of file macro.hpp.

◆ CONDITION_BOOL_WAIT_TRYFUN

#define CONDITION_BOOL_WAIT_TRYFUN ( cond,
lock,
var,
tryfun )
Value:
\
std::unique_lock<std::mutex> __LUTILS_CONDITIONAL_BOOL_WAIT_TRYFUN_GUARD_##cond_##lock_##var__(lock); \
try { \
cond.wait(__LUTILS_CONDITIONAL_BOOL_WAIT_TRYFUN_GUARD_##cond_##lock_##var__, [this]() { return var; }); \
} catch (...) { \
break; \
}

CONDITION_BOOL_WAIT_TRYFUN provides safe concurrent waiting on a shared variable and call a provided function in case of and exception.

It is advisable that tryfun does not throw exceptions

Definition at line 106 of file macro.hpp.

◆ CONDITION_STD_SET

#define CONDITION_STD_SET ( cond,
lock,
var,
val )
Value:
{ \
{ \
std::lock_guard<std::mutex> __LUTILS_CONDITIONAL_SET_GUARD_##cond_##lock_##var__(lock); \
var = val; \
} \
cond.notify_all(); \
}

CONDITION_STD_SET provides safe concurrent setting of a shared variable

Definition at line 77 of file macro.hpp.

◆ DEBUG_NOREL

#define DEBUG_NOREL ( MSG)
Value:
DEBUG(MSG)
#define DEBUG(...)

Definition at line 61 of file macro.hpp.

◆ DECLTYPE

#define DECLTYPE ( x)
Value:
decltype(x)

Definition at line 150 of file macro.hpp.

◆ ERROR_NOREL

#define ERROR_NOREL ( MSG)
Value:
ERROR(MSG)
#define ERROR(...)
Definition messenger.hpp:90

Define messages not present in RELEASE compilation

Definition at line 58 of file macro.hpp.

◆ GET_COUNT

#define GET_COUNT ( _1,
_2,
_3,
_4,
_5,
_6,
_7,
_8,
_9,
COUNT,
... )
Value:
COUNT

Definition at line 159 of file macro.hpp.

◆ HERE_AUTO_DEF

#define HERE_AUTO_DEF ( funname)
Value:
static auto TYPEA = ::tools::filt(this); \
static auto HERE = std::string("< ") + TYPEA + std::string(" >::") + std::string(#funname); \
gentraits< T >::t_is constexpr filt(T *)

Automatically define the function name, needed to display informative messages

Definition at line 41 of file macro.hpp.

◆ HERE_DEF

#define HERE_DEF ( cn,
fn )
Value:
static char const* const HERE = "< " #cn " >:: " #fn " ";

Definition at line 45 of file macro.hpp.

◆ HERE_FUN_DEF

#define HERE_FUN_DEF ( fn)
Value:
static char const* const HERE = #fn " ";

Define the name of the current function, which is needed to display informative messages

Definition at line 51 of file macro.hpp.

◆ HERE_TMPL_DEF

#define HERE_TMPL_DEF ( T,
funname )
Value:
typedef typename ::tools::gentraits<T> t_gentraits_T; \
static typename t_gentraits_T::t_is const TYPEA = t_gentraits_T::filt(); \
static typename t_gentraits_T::t_is const HERE = #funname + "< " + TYPEA + " >";

Define a templated function name, needed to display informative messages

Definition at line 32 of file macro.hpp.

◆ INFO_NOREL

#define INFO_NOREL ( MSG)
Value:
INFO(MSG)
#define INFO(...)
Definition messenger.hpp:98

Definition at line 60 of file macro.hpp.

◆ SELECT

#define SELECT ( NAME,
NUM )
Value:
CAT(NAME##_, NUM)
#define CAT(A, B)
Definition macro.hpp:156

Definition at line 157 of file macro.hpp.

◆ VA_SELECT

#define VA_SELECT ( NAME,
... )
Value:
SELECT(NAME, VA_SIZE(__VA_ARGS__))(__VA_ARGS__)
#define VA_SIZE(...)
Definition macro.hpp:160
#define SELECT(NAME, NUM)
Definition macro.hpp:157

Definition at line 162 of file macro.hpp.

◆ VA_SIZE

#define VA_SIZE ( ...)
Value:
GET_COUNT(__VA_ARGS__, 9, 8, 7, 6, 5, 4, 3, 2, 1)
#define GET_COUNT(_1, _2, _3, _4, _5, _6, _7, _8, _9, COUNT,...)
Definition macro.hpp:159

Definition at line 160 of file macro.hpp.

◆ WARN_NOREL

#define WARN_NOREL ( MSG)
Value:
WARN(MSG)
#define WARN(...)
Definition messenger.hpp:82

Definition at line 59 of file macro.hpp.