DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
macro.hpp File Reference
#include <string>
#include "dbe/convenience.hpp"
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 159 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 88 of file macro.hpp.

88 *
89 * Upon any exception thrown it will break an enclosing loop
90 */
91#define CONDITION_BOOL_WAIT(cond,lock,var) \
92 \
93 std::unique_lock<std::mutex> \
94__LUTILS_CONDITIONAL_BOOL_WAIT_GUARD_##cond_##lock_##var__(lock); \
95 try { \
96cond.wait(__LUTILS_CONDITIONAL_BOOL_WAIT_GUARD_##cond_##lock_##var__, [this]() \
97 { return var;}); \
98 } catch (...) {\
caught dunedaq::conffwk::Exception exception

◆ 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 122 of file macro.hpp.

122 *
123 * Upon any exception thrown it will break an enclosing loop
124 */
125#define CONDITION_BOOL_WAIT_FUN(cond,lock,fun) \
126 \
127 std::unique_lock<std::mutex> \
128 __LUTILS_CONDITIONAL_BOOL_WAIT_FUN_GUARD_##cond_##lock_(lock); \
129 try { \
130cond.wait(__LUTILS_CONDITIONAL_BOOL_WAIT_FUN_GUARD_##cond_##lock_, fun ); \
131 } catch(...) {\

◆ 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 138 of file macro.hpp.

138 *
139 * It is advisable that tryfun does not throw exceptions
140 */
141#define CONDITION_BOOL_WAIT_FUN_TRYFUN(cond,lock,fun,tryfun) \
142 \
143 std::unique_lock<std::mutex> \
144 __LUTILS_CONDITIONAL_BOOL_WAIT_FUN_TRYFUN_GUARD_##cond_##lock_(lock); \
145 try { \
146cond.wait(__LUTILS_CONDITIONAL_BOOL_WAIT_FUN_TRYFUN_GUARD_##cond_##lock_, fun ); \
147 } catch(...) {\

◆ 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 105 of file macro.hpp.

105 *
106 * It is advisable that tryfun does not throw exceptions
107 */
108#define CONDITION_BOOL_WAIT_TRYFUN(cond,lock,var,tryfun) \
109 \
110 std::unique_lock<std::mutex> \
111__LUTILS_CONDITIONAL_BOOL_WAIT_TRYFUN_GUARD_##cond_##lock_##var__(lock); \
112 try { \
113cond.wait(__LUTILS_CONDITIONAL_BOOL_WAIT_TRYFUN_GUARD_##cond_##lock_##var__, [this]() \
114 { return var;}); \
115 } catch (...) {\

◆ 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 73 of file macro.hpp.

73
76#define CONDITION_STD_SET(cond,lock,var,val) \
77 { \
78 { \
79 std::lock_guard<std::mutex> \
80 __LUTILS_CONDITIONAL_SET_GUARD_##cond_##lock_##var__(lock); \
81 var = val; \
82 } \

◆ DEBUG_NOREL

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

Definition at line 57 of file macro.hpp.

◆ DECLTYPE

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

Definition at line 153 of file macro.hpp.

◆ ERROR_NOREL

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

Define messages not present in RELEASE compilation

Definition at line 54 of file macro.hpp.

◆ GET_COUNT

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

Definition at line 162 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 36 of file macro.hpp.

36#define HERE_AUTO_DEF(funname) \
37 static auto TYPEA = ::tools::filt(this); \
38 static auto HERE = std::string("< ") + TYPEA \
39 + std::string(" >::") + std::string(#funname); \
40

◆ HERE_DEF

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

Definition at line 41 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 47 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 27 of file macro.hpp.

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

◆ INFO_NOREL

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

Definition at line 56 of file macro.hpp.

◆ SELECT

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

Definition at line 160 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:163
#define SELECT(NAME, NUM)
Definition macro.hpp:160

Definition at line 165 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:162

Definition at line 163 of file macro.hpp.

◆ WARN_NOREL

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

Definition at line 55 of file macro.hpp.