All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Modules | Files | Classes | Macros
Assertions

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

Collaboration diagram for Assertions:

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

#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
conditionCondition to test
Returns
Stream to output extra assert information

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

#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;