#include <string>
#include "dbe/convenience.hpp"
Go to the source code of this file.
|
#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, ...) |
|
◆ CAT
◆ 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 | ) |
|
◆ DECLTYPE
◆ ERROR_NOREL
#define ERROR_NOREL |
( |
| MSG | ) |
|
Value: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, |
|
|
| ... ) |
◆ HERE_AUTO_DEF
#define HERE_AUTO_DEF |
( |
| funname | ) |
|
Value:
static auto HERE = std::string("< ") + TYPEA \
+ std::string(" >::") + std::string(#funname); \
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 | ) |
|
◆ SELECT
#define SELECT |
( |
| NAME, |
|
|
| NUM ) |
◆ VA_SELECT
#define VA_SELECT |
( |
| NAME, |
|
|
| ... ) |
Value:
#define SELECT(NAME, NUM)
Definition at line 165 of file macro.hpp.
◆ 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 at line 163 of file macro.hpp.
◆ WARN_NOREL
#define WARN_NOREL |
( |
| MSG | ) |
|