UHD 003.005.002-0-unknown

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros
safe_call.hpp File Reference
`#include <uhd/config.hpp>`
`#include <uhd/exception.hpp>`
`#include <uhd/utils/log.hpp>`

Go to the source code of this file.

## Macros
#define | _UHD_SAFE_CALL_WARNING(code, what)
| helper macro for safe call to produce warnings More...
#define | UHD_SAFE_CALL(code)

## Macro Definition Documentation

#define _UHD_SAFE_CALL_WARNING | ( |  | code,
|  |  | what
| ) |  |

Value:
UHD_LOGV(rarely) << \
UHD_THROW_SITE_INFO("Exception caught in safe-call.") + #code + " -> " + what \
;
UHD_LOGV
#define UHD_LOGV(verbosity)
Definition: log.hpp:57
uhd::_log::rarely
Definition: log.hpp:75
UHD_THROW_SITE_INFO
#define UHD_THROW_SITE_INFO(what)
Definition: exception.hpp:142

helper macro for safe call to produce warnings

#define UHD_SAFE_CALL | ( |  | code | ) |

Value:
try{code} \
catch(const std::exception &e){ \
_UHD_SAFE_CALL_WARNING(code, e.what()); \
} \
catch(...){ \
_UHD_SAFE_CALL_WARNING(code, "unknown exception"); \
}
_UHD_SAFE_CALL_WARNING
#define _UHD_SAFE_CALL_WARNING(code, what)
helper macro for safe call to produce warnings
Definition: safe_call.hpp:26

A safe-call catches all exceptions thrown by code, and creates a verbose warning about the exception. Usage: UHD_SAFE_CALL(some_code_to_call();)

Parameters

  code | the block of code to call safely