RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Assert.h
浏览该文件的文档.
1
28// Copyright 2015 Sensics, Inc.
29// Distributed under the Boost Software License, Version 1.0.
30// (See accompanying file LICENSE_1_0.txt or copy at
31// http://www.boost.org/LICENSE_1_0.txt)
32//
33// Includes code adapted from the following Boost Software License v1.0 sources:
34// - <boost/current_function.hpp>
35// - <boost/assert.hpp>
36
37// Undefine macro for safe multiple inclusion
38#undef VRPN_CURRENT_FUNCTION
39
40// ---------------------------------------------------------- //
41// Begin code adapted from <boost/current_function.hpp>
42// at revision 5d353ad2b of the boost.assert repository
43// https://github.com/boostorg/assert/blob/5d353ad2b92208c6ca300f4b47fdf04c87a8a593/include/boost/current_function.hpp
44//
45// Original notice follows:
46//
47// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
48//
49// Distributed under the Boost Software License, Version 1.0.
50// See accompanying file LICENSE_1_0.txt or copy at
51// http://www.boost.org/LICENSE_1_0.txt
52//
53// http://www.boost.org/libs/assert/current_function.html
54//
55#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || \
56 (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__)
57
58#define VRPN_CURRENT_FUNCTION __PRETTY_FUNCTION__
59
60#elif defined(__DMC__) && (__DMC__ >= 0x810)
61
62#define VRPN_CURRENT_FUNCTION __PRETTY_FUNCTION__
63
64#elif defined(__FUNCSIG__)
65
66#define VRPN_CURRENT_FUNCTION __FUNCSIG__
67
68#elif(defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || \
69 (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
70
71#define VRPN_CURRENT_FUNCTION __FUNCTION__
72
73#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
74
75#define VRPN_CURRENT_FUNCTION __FUNC__
76
77#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
78
79#define VRPN_CURRENT_FUNCTION __func__
80
81#elif defined(__cplusplus) && (__cplusplus >= 201103)
82
83#define VRPN_CURRENT_FUNCTION __func__
84
85#else
86
87#define VRPN_CURRENT_FUNCTION "(unknown)"
88
89#endif
90
91// End code adapted from <boost/current_function.hpp>
92// ---------------------------------------------------------- //
93
94// ---------------------------------------------------------- //
95// Begin code adapted from <boost/assert.hpp>
96// at revision 5d353ad2b of the boost.assert repository
97// https://github.com/boostorg/assert/blob/5d353ad2b92208c6ca300f4b47fdf04c87a8a593/include/boost/assert.hpp
98//
99// Original notice follows:
100//
101// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
102// Copyright (c) 2007, 2014 Peter Dimov
103// Copyright (c) Beman Dawes 2011
104//
105// Distributed under the Boost Software License, Version 1.0.
106// See accompanying file LICENSE_1_0.txt or copy at
107// http://www.boost.org/LICENSE_1_0.txt
108//
109// Note: There are no include guards. This is intentional.
110//
111// See http://www.boost.org/libs/assert/assert.html for documentation.
112//
113
114//
115// VRPN_ASSERT, VRPN_ASSERT_MSG
116//
117
118#undef VRPN_ASSERT
119#undef VRPN_ASSERT_MSG
120
121#if defined(VRPN_DISABLE_ASSERTS) || ( defined(VRPN_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) )
122
123#define VRPN_ASSERT(expr) ((void)0)
124#define VRPN_ASSERT_MSG(expr, msg) ((void)0)
125
126#elif defined(VRPN_ENABLE_ASSERT_HANDLER) || ( defined(VRPN_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) )
127
129#ifndef VRPN_LIKELY
130#define VRPN_LIKELY(X) (X)
131#endif
132
133#ifndef VRPN_API
134#include "vrpn_Configure.h"
135#endif
136
137namespace vrpn {
138 VRPN_API void assertion_failed(char const *expr, char const *function,
139 char const *file, long line);
140 VRPN_API void assertion_failed_msg(char const *expr, char const *msg,
141 char const *function, char const *file,
142 long line);
143} // namespace vrpn
144
145#define VRPN_ASSERT(expr) (VRPN_LIKELY(!!(expr))? ((void)0): ::vrpn::assertion_failed(#expr, VRPN_CURRENT_FUNCTION, __FILE__, __LINE__))
146#define VRPN_ASSERT_MSG(expr, msg) (VRPN_LIKELY(!!(expr))? ((void)0): ::vrpn::assertion_failed_msg(#expr, msg, VRPN_CURRENT_FUNCTION, __FILE__, __LINE__))
147
148#else
149
150#include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
151
152#define VRPN_ASSERT(expr) assert(expr)
153#define VRPN_ASSERT_MSG(expr, msg) assert((expr) && (msg))
154
155#endif
156
157//
158// VRPN_VERIFY, VRPN_VERIFY_MSG
159//
160
161#undef VRPN_VERIFY
162#undef VRPN_VERIFY_MSG
163
164
165#if defined(VRPN_DISABLE_ASSERTS) || ( !defined(VRPN_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) )
166
167# define VRPN_VERIFY(expr) ((void)(expr))
168# define VRPN_VERIFY_MSG(expr, msg) ((void)(expr))
169
170#else
171
172# define VRPN_VERIFY(expr) VRPN_ASSERT(expr)
173# define VRPN_VERIFY_MSG(expr, msg) VRPN_ASSERT_MSG(expr,msg)
174
175#endif
176
177// End code adapted from <boost/assert.hpp>
178// --
179
180// ---------
181// Documentation