Ponca  7d8ac87a7de01d881c9fde3c42e397b44bffb901
Point Cloud Analysis library
Loading...
Searching...
No Matches
Assert.h
1#pragma once
2
3#include "./Macro.h"
4
5#define PONCA_ERROR \
6 PONCA_MACRO_START \
7 PONCA_PRINT_ERROR(""); \
8 PONCA_CRASH; \
9 PONCA_MACRO_END
10
11#define PONCA_ERROR_MSG(MSG) \
12 PONCA_MACRO_START \
13 PONCA_PRINT_ERROR(MSG); \
14 PONCA_CRASH; \
15 PONCA_MACRO_END
16
17#define PONCA_ASSERT(EXPR) \
18 PONCA_MACRO_START \
19 if (!(EXPR)) \
20 { \
21 PONCA_ERROR_MSG(PONCA_STR(EXPR)); \
22 } \
23 PONCA_MACRO_END
24
25#define PONCA_ASSERT_MSG(EXPR, MSG) \
26 PONCA_MACRO_START \
27 if (!(EXPR)) \
28 { \
29 PONCA_ERROR_MSG(MSG); \
30 } \
31 PONCA_MACRO_END
32
33#ifdef PONCA_DEBUG
34# define PONCA_DEBUG_ASSERT(EXPR) PONCA_ASSERT(EXPR)
35# define PONCA_DEBUG_ASSERT_MSG(EXPR, MSG) PONCA_ASSERT_MSG(EXPR, MSG)
36# define PONCA_DEBUG_ERROR_MSG(MSG) PONCA_ERROR_MSG(MSG)
37# define PONCA_DEBUG_ERROR PONCA_ERROR
38#else
39# define PONCA_DEBUG_ASSERT(EXPR)
40# define PONCA_DEBUG_ASSERT_MSG(EXPR, MSG)
41# define PONCA_DEBUG_ERROR_MSG(MSG)
42# define PONCA_DEBUG_ERROR
43#endif