|
Drake
|
Provides Drake's assertion implementation. More...
#include <type_traits>#include "drake/drakeCommon_export.h"

Go to the source code of this file.
Macros | |
| #define | DRAKE_ASSERT(condition) |
DRAKE_ASSERT(condition) is similar to the built-in assert(condition) from the C++ system header <cassert>. More... | |
| #define | DRAKE_ABORT_UNLESS(condition) |
Evaluates condition and iff the value is false will ::abort() the program with a message showing at least the condition text, function name, file, and line. More... | |
| #define | DRAKE_ABORT() |
Like DRAKE_ABORT_UNLESS(false), except that the meaningless "false" condition test is not included in the message. More... | |
Provides Drake's assertion implementation.
This is intended to be used both within Drake and by other software. Drake's asserts can be armed and disarmed independently from the system-wide asserts.
| #define DRAKE_ABORT | ( | ) |
Like DRAKE_ABORT_UNLESS(false), except that the meaningless "false" condition test is not included in the message.
| #define DRAKE_ABORT_UNLESS | ( | condition | ) |
Evaluates condition and iff the value is false will ::abort() the program with a message showing at least the condition text, function name, file, and line.
| #define DRAKE_ASSERT | ( | condition | ) |
DRAKE_ASSERT(condition) is similar to the built-in assert(condition) from the C++ system header <cassert>.
Unless Drake's assertions are disarmed by the pre-processor definitions listed below, DRAKE_ASSERT will evaluate condition and iff the value is false will ::abort() the program with a message showing at least the condition text, function name, file, and line.
Assertions are enabled or disabled using the following pre-processor macros:
DRAKE_ENABLE_ASSERTS is defined, then DRAKE_ASSERT is armed.DRAKE_DISABLE_ASSERTS is defined, then DRAKE_ASSERT is disarmed.This header will define exactly one of either DRAKE_ASSERT_IS_ARMED or DRAKE_ASSERT_IS_DISARMED to indicate whether DRAKE_ASSERT is armed.
One difference versus the standard assert(condition) is that the condition within DRAKE_ASSERT is always syntax-checked, even if Drake's assertions are disarmed.
Treat DRAKE_ASSERT like a statement – it must always be used in block scope, and must always be followed by a semicolon.