Assertions

The assertion API used by OpenSurgSim code. More...

## Modules

| Internal assertion helpers
| Not meant for public consumption.

## Files

file | Assert.h
| The header that provides the assertion API.

## Classes

class | SurgSim::Framework::AssertionFailure
| An exception class thrown by SURGSIM_ASSERT() failures and SURGSIM_FAILURE(). More...

## Macros

#define | SURGSIM_ASSERT(condition)
| Assert that `condition` is true. More...
#define | SURGSIM_FAILURE()
| Report that something very bad has happened and abort program execution. More...

## Detailed Description

The assertion API used by OpenSurgSim code.

See also
  Logging API

## Macro Definition Documentation

## SURGSIM_ASSERT

#define SURGSIM_ASSERT | ( |  | condition | ) |

Assert that `condition` is true.

If not, abort program execution, printing an error message that will include `failText`, the condition, source file/line, etc.

Parameters

  condition | Condition to test

Returns
  Stream to output extra assert information

Example: SURGSIM_ASSERT(index >= 0) << "bad index: " << index;

## SURGSIM_FAILURE

#define SURGSIM_FAILURE | ( |  | ) |

Report that something very bad has happened and abort program execution.

An error message will be printed, and will include `failText`, source file/line, etc. This is pretty similar to SURGSIM_ASSERT(true, ...), except "true" won't be included in the resulting message. =)

Returns
  Stream to output extra failure information

Example: SURGSIM_FAILURE() << failText;