ATLAS Offline Software
|
#include "AsgMessaging/MsgStreamMacros.h"
#include "boost/preprocessor/facilities/overload.hpp"
#include "CxxUtils/AthUnlikelyMacros.h"
#include "AthenaBaseComps/AthCheckMacros.h"
Go to the source code of this file.
Macros | |
#define | ASG_CHECK(...) BOOST_PP_OVERLOAD(ASG_CHECK_, __VA_ARGS__)(__VA_ARGS__) |
Helper macro for checking the status code returned by a function call. More... | |
#define | ASG_CHECK_1(EXP) |
#define | ASG_CHECK_2(EXP, RET) |
#define | ASG_CHECK_SA(SOURCE, EXP) |
Helper macro for checking the status code of a call outside of an ASG tool. More... | |
#define ASG_CHECK | ( | ... | ) | BOOST_PP_OVERLOAD(ASG_CHECK_, __VA_ARGS__)(__VA_ARGS__) |
Helper macro for checking the status code returned by a function call.
To be able to write code in a compact form, we can use this macro to exchange code like:
if( someFunction().isFailure() ) {
ATH_MSG_FATAL( "Failed to call function someFunction" );
return StatusCode::FAILURE;
}
With something as simple as:
or for functions that do not return a StatusCode:
ASG_CHECK( someFunction(), -1 );
The macro may only be used inside of member functions of dual-use tools.
#define ASG_CHECK_1 | ( | EXP | ) |
#define ASG_CHECK_2 | ( | EXP, | |
RET | |||
) |
#define ASG_CHECK_SA | ( | SOURCE, | |
EXP | |||
) |
Helper macro for checking the status code of a call outside of an ASG tool.
The other version of this macro can be used to write very compact code inside a dual-use tool. But since it relies on functions provided by the dual-use tool, it can't be used in general code. For instance to check the status code returned by the initialisation function of a dual-use tool.
This version of the macro can be used in such a setup.