9#ifndef ASG_MESSAGING__MESSAGE_CHECK_H
10#define ASG_MESSAGING__MESSAGE_CHECK_H
113#define ANA_MSG_HEADER(NAME) \
116 MsgStream& msg (MSG::Level level); \
117 bool msgLvl (MSG::Level lvl); \
118 void setMsgLevel (MSG::Level level); }
120#ifdef XAOD_STANDALONE
121#define ASG_TOOLS_MSG_STREAM(NAME,TITLE) \
122 static MsgStream& NAME {::asg::MsgHelpers::pkgMsgStream (TITLE)};
124#define ASG_TOOLS_MSG_STREAM(NAME,TITLE) \
125 static thread_local MsgStream NAME {::asg::MsgHelpers::pkgMsgStream (TITLE)};
133#define ANA_MSG_SOURCE(NAME,TITLE) \
138 ASG_TOOLS_MSG_STREAM (result, TITLE); \
142 MsgStream& msg (MSG::Level level) \
144 return msg() << level; \
147 bool msgLvl (MSG::Level lvl) \
149 if (msg().level() <= lvl) \
159 void setMsgLevel (MSG::Level level) \
161 ::asg::MsgHelpers::setPkgMsgLevel (TITLE, level); \
180 return sc.isSuccess(); }
184 return StatusCode::SUCCESS;}
188 return StatusCode::FAILURE;}
245#if defined( __GNUC__ )
246# define MSGSTREAM_FNAME CxxUtils::normalizeFunctionName(__PRETTY_FUNCTION__)
248# define MSGSTREAM_FNAME ""
253#if defined( __GNUC__ )
254# define ASG_TOOLS_MSGSTREAM_FNAME CxxUtils::normalizeFunctionName(__PRETTY_FUNCTION__)
256# define ASG_TOOLS_MSGSTREAM_FNAME ""
266#define ASG_TOOLS_MSGSTREAM_PREFIX \
267 __FILE__ << ":" << __LINE__ << " (" << ASG_TOOLS_MSGSTREAM_FNAME << "): "
270#define ANA_MSG_LVL_SERIOUS( lvl, xmsg ) \
271 msg( lvl ) << ASG_TOOLS_MSGSTREAM_PREFIX << xmsg << endmsg
274#define ANA_MSG_LVL_NOCHK( lvl, xmsg ) \
275 msg( lvl ) << xmsg << endmsg
278#define ANA_MSG_LVL( lvl, xmsg ) \
280 if( msg().level() <= lvl ) { \
281 ANA_MSG_LVL_NOCHK( lvl, xmsg ); \
286#define ANA_MSG_VERBOSE( xmsg ) ANA_MSG_LVL( MSG::VERBOSE, xmsg )
288#define ANA_MSG_DEBUG( xmsg ) ANA_MSG_LVL( MSG::DEBUG, xmsg )
290#define ANA_MSG_INFO( xmsg ) ANA_MSG_LVL_NOCHK( MSG::INFO, xmsg )
292#define ANA_MSG_WARNING( xmsg ) ANA_MSG_LVL_NOCHK( MSG::WARNING, xmsg )
294#define ANA_MSG_ERROR( xmsg ) ANA_MSG_LVL_SERIOUS( MSG::ERROR, xmsg )
296#define ANA_MSG_FATAL( xmsg ) ANA_MSG_LVL_SERIOUS( MSG::FATAL, xmsg )
298#define ANA_MSG_ALWAYS( xmsg ) ANA_MSG_LVL_NOCHK( MSG::ALWAYS, xmsg )
314#define ANA_CHECK_SET_TYPE(TYPE) \
315 typedef TYPE AsgToolsCheckResultType;
324#define ANA_CHECK(EXP) \
325 { const auto sc__ = EXP; \
326 typedef typename std::decay<decltype(sc__)>::type scType__; \
327 if (ATH_UNLIKELY(!::asg::CheckHelper<scType__>::isSuccess (sc__))) { \
328 ANA_MSG_ERROR ("Failed to call \"" << #EXP << "\""); \
329 return ::asg::CheckHelper<AsgToolsCheckResultType>::failureCode(); \
339#define ANA_CHECK_THROW(EXP) \
340 { const auto sc__ = EXP; \
341 typedef typename std::decay<decltype(sc__)>::type scType__; \
342 if (ATH_UNLIKELY(!::asg::CheckHelper<scType__>::isSuccess (sc__))) { \
343 std::ostringstream str; \
345 ANA_MSG_ERROR ("Failed to call \"" << str.str() << "\", throwing exception"); \
346 ::asg::detail::throw_check_fail (str.str()); \
Define macros for attributes used to control the static checker.
void throw_check_fail(const std::string &str)
throw an error for a failed check
Normalize a pretty-printed C++ function name,.
static bool isSuccess(const StatusCode &sc)
whether the status code reports a success
static constexpr auto successCode()
produce a status code to report success
static constexpr auto failureCode()
produce a status code to report failure
static bool isSuccess(const T *sc)
whether the status code reports a success
static T * failureCode()
produce a status code to report failure
static bool successCode()
produce a status code to report success
static bool isSuccess(const bool &sc)
whether the status code reports a success
static bool failureCode()
produce a status code to report failure
static int failureCode()
produce a status code to report failure
static int successCode()
produce a status code to report success
this is an internal traits class for status codes used by the ANA_CHECK* macros