$search
#include "ros/console.h"
#include "ros/static_assert.h"
#include <ros/platform.h>
#include <stdlib.h>
Go to the source code of this file.
Defines | |
#define | ROS_ASSERT(cond) |
Asserts that the provided condition evaluates to true. | |
#define | ROS_ASSERT_CMD(cond, cmd) |
Runs a command if the provided condition is false. | |
#define | ROS_ASSERT_ENABLED |
#define | ROS_ASSERT_MSG(cond,...) |
Asserts that the provided condition evaluates to true. | |
#define | ROS_BREAK() |
Aborts program execution. | |
#define | ROS_ISSUE_BREAK() abort(); |
Always issues a breakpoint instruction. |
Definition in file assert.h.
#define ROS_ASSERT | ( | cond | ) |
do { \ if (!(cond)) { \ ROS_FATAL("ASSERTION FAILED\n\tfile = %s\n\tline = %d\n\tcond = %s\n", __FILE__, __LINE__, #cond); \ ROS_ISSUE_BREAK() \ } \ } while (0)
Asserts that the provided condition evaluates to true.
If it is false, program execution will abort, with an informative statement about which assertion failed, in what file. Use ROS_ASSERT instead of assert() itself.
If running inside a debugger, ROS_ASSERT will allow you to step past the assertion.
#define ROS_ASSERT_CMD | ( | cond, | |||
cmd | ) |
#define ROS_ASSERT_MSG | ( | cond, | |||
... | ) |
do { \ if (!(cond)) { \ ROS_FATAL("ASSERTION FAILED\n\tfile = %s\n\tline = %d\n\tcond = %s\n\tmessage = ", __FILE__, __LINE__, #cond); \ ROS_FATAL(__VA_ARGS__); \ ROS_FATAL("\n"); \ ROS_ISSUE_BREAK(); \ } \ } while (0)
Asserts that the provided condition evaluates to true.
If it is false, program execution will abort, with an informative statement about which assertion failed, in what file, and it will print out a printf-style message you define. Example usage:
ROS_ASSERT_MSG(x > 0, "Uh oh, x went negative. Value = %d", x);
If running inside a debugger, ROS_ASSERT will allow you to step past the assertion.
#define ROS_BREAK | ( | ) |
do { \ ROS_FATAL("BREAKPOINT HIT\n\tfile = %s\n\tline=%d\n", __FILE__, __LINE__); \ ROS_ISSUE_BREAK() \ } while (0)
Aborts program execution.
Aborts program execution with an informative message stating what file and line it was called from. Use ROS_BREAK instead of calling assert(0) or ROS_ASSERT(0).
If running inside a debugger, ROS_BREAK will allow you to step past the breakpoint.
#define ROS_ISSUE_BREAK | ( | ) | abort(); |