exception.h File Reference
Go to the source code of this file.
Macros | |
#define | INTEROP_THROW(EXCEPTION, MESSAGE) |
#define | INTEROP_BOUNDS_CHECK(VALUE, RANGE, MESSAGE) |
#define | INTEROP_RANGE_CHECK(VALUE, RANGE, EXCEPTION, MESSAGE) |
#define | INTEROP_RANGE_CHECK_GT(VALUE, RANGE, EXCEPTION, MESSAGE) |
#define | INTEROP_RANGE_CHECK_NE(VALUE, RANGE, EXCEPTION, MESSAGE) |
Detailed Description
Exception utilities
The header provides a macro to throw more informative exceptions
- Date
- 6/11/16
- Version
- 1.0
- Copyright
- GNU Public License.
Macro Definition Documentation
#define INTEROP_BOUNDS_CHECK | ( | VALUE, | |
RANGE, | |||
MESSAGE | |||
) |
Value:
static_cast<std::ostringstream&>(std::ostringstream().flush() << MESSAGE << " - " << VALUE << " >= " << RANGE << "\n" << __FILE__ << "::" \
<< __FUNCTION__<< " (" << __LINE__ << ")" ).str())
Definition: metric_exceptions.h:25
Throw exception if value exceeds bounds
#define INTEROP_RANGE_CHECK | ( | VALUE, | |
RANGE, | |||
EXCEPTION, | |||
MESSAGE | |||
) |
Value:
if((VALUE) >= (RANGE)) throw EXCEPTION ( \
static_cast<std::ostringstream&>(std::ostringstream().flush() << MESSAGE << " - " << VALUE << " >= " << RANGE << "\n" << __FILE__ << "::" \
<< __FUNCTION__<< " (" << __LINE__ << ")" ).str())
Throw exception if value exceeds bounds
#define INTEROP_RANGE_CHECK_GT | ( | VALUE, | |
RANGE, | |||
EXCEPTION, | |||
MESSAGE | |||
) |
Value:
if((VALUE) > (RANGE)) throw EXCEPTION ( \
static_cast<std::ostringstream&>(std::ostringstream().flush() << MESSAGE << " - " << VALUE << " > " << RANGE << "\n" << __FILE__ << "::" \
<< __FUNCTION__<< " (" << __LINE__ << ")" ).str())
Throw exception if value exceeds bounds
#define INTEROP_RANGE_CHECK_NE | ( | VALUE, | |
RANGE, | |||
EXCEPTION, | |||
MESSAGE | |||
) |
Value:
if((VALUE) > (RANGE)) throw EXCEPTION ( \
static_cast<std::ostringstream&>(std::ostringstream().flush() << MESSAGE << " - " << VALUE << " != " << RANGE << "\n" << __FILE__ << "::" \
<< __FUNCTION__<< " (" << __LINE__ << ")" ).str())
Throw exception if value exceeds bounds
#define INTEROP_THROW | ( | EXCEPTION, | |
MESSAGE | |||
) |
Value:
throw EXCEPTION ( static_cast<std::ostringstream&>(std::ostringstream().flush() << MESSAGE << "\n" << __FILE__<< "::" \
<< __FUNCTION__<< " (" << __LINE__ << ")" ).str())
Create a formatted message for the given exception
- Note
- The .flush() is a workaround for clang