버전
menu_open
link
Wwise SDK 2019.2.15
AkAssert.h
이 파일의 문서화 페이지로 가기
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Version: <VERSION> Build: <BUILDNUMBER>
25  Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
26 *******************************************************************************/
27 
28 #ifndef _AK_AKASSERT_H_
29 #define _AK_AKASSERT_H_
30 
31 #if defined(__EMSCRIPTEN__)
32 #include <assert.h>
33 #endif
34 
35 #if defined( _DEBUG ) && !(defined AK_DISABLE_ASSERTS)
36  #ifndef AK_ENABLE_ASSERTS
37  #define AK_ENABLE_ASSERTS
38  #endif
39 #endif
40 
41 #ifdef AK_ENABLE_ASSERTS
43  #ifndef AK_ASSERT_HOOK
44  AK_CALLBACK( void, AkAssertHook)(
45  const char * in_pszExpression, ///< Expression
46  const char * in_pszFileName, ///< File Name
47  int in_lineNumber ///< Line Number
48  );
49  #define AK_ASSERT_HOOK
50  #endif
51 #endif
52 
53 #if !defined( AKASSERT )
54  #include <AK/SoundEngine/Common/AkTypes.h> //For AK_Fail/Success
55 
56  #if defined( AK_ENABLE_ASSERTS )
57  extern AKSOUNDENGINE_API AkAssertHook g_pAssertHook;
58 
59  #if defined(__EMSCRIPTEN__)
60  #define AKASSERT(Condition) assert(Condition)
61  #else
62  // These platforms use a built-in g_pAssertHook (and do not fall back to the regular assert macro)
63  #define AKASSERT(Condition) ((Condition) ? ((void) 0) : g_pAssertHook( #Condition, __FILE__, __LINE__) )
64  #endif
65 
66  #define AKVERIFY AKASSERT
67 
68  #ifdef _DEBUG
69  #define AKASSERTD AKASSERT
70  #else
71  #define AKASSERTD(Condition) ((void)0)
72  #endif
73 
74  #else // defined( AK_ENABLE_ASSERTS )
75 
76  #define AKASSERT(Condition) ((void)0)
77  #define AKASSERTD(Condition) ((void)0)
78  #define AKVERIFY(x) ((void)(x))
79 
80  #endif // defined( AK_ENABLE_ASSERTS )
81 
82  #define AKASSERT_RANGE(Value, Min, Max) (AKASSERT(((Value) >= (Min)) && ((Value) <= (Max))))
83 
84  #define AKASSERTANDRETURN( __Expression, __ErrorCode )\
85  if (!(__Expression))\
86  {\
87  AKASSERT(__Expression);\
88  return __ErrorCode;\
89  }\
90 
91  #define AKASSERTPOINTERORFAIL( __Pointer ) AKASSERTANDRETURN( __Pointer != NULL, AK_Fail )
92  #define AKASSERTSUCCESSORRETURN( __akr ) AKASSERTANDRETURN( __akr == AK_Success, __akr )
93 
94  #define AKASSERTPOINTERORRETURN( __Pointer ) \
95  if ((__Pointer) == NULL)\
96  {\
97  AKASSERT((__Pointer) == NULL);\
98  return ;\
99  }\
100 
101  #if defined( AK_WIN ) && ( _MSC_VER >= 1600 )
102  // Compile-time assert
103  #define AKSTATICASSERT( __expr__, __msg__ ) static_assert( (__expr__), (__msg__) )
104  #else
105  // Compile-time assert
106  #define AKSTATICASSERT( __expr__, __msg__ ) typedef char __AKSTATICASSERT__[(__expr__)?1:-1]
107  #endif
108 
109 #endif // ! defined( AKASSERT )
110 
111 #ifdef AK_ENABLE_ASSERTS
112 
113 
114 //Do nothing. This is a dummy function, so that g_pAssertHook is never NULL.
115 #define DEFINEDUMMYASSERTHOOK void AkAssertHookFunc( \
116 const char* in_pszExpression,\
117 const char* in_pszFileName,\
118 int in_lineNumber)\
119 {\
120 \
121 }\
122 AkAssertHook g_pAssertHook = AkAssertHookFunc;
123 #else
124 #define DEFINEDUMMYASSERTHOOK
125 
126 #endif
127 
128 // Compile-time assert. Usage:
129 // AkStaticAssert<[your boolean expression here]>::Assert();
130 // Example:
131 // AkStaticAssert<sizeof(MyStruct) == 20>::Assert(); //If you hit this, you changed the size of MyStruct!
132 // Empty default template
133 template <bool b>
134 struct AkStaticAssert {};
135 
136 // Template specialized on true
137 template <>
138 struct AkStaticAssert<true>
139 {
140  static void Assert() {}
141 };
142 
143 #endif
144 
static void Assert()
Definition: AkAssert.h:140
#define AKSOUNDENGINE_API
#define AK_CALLBACK(_type, _name)
void(* AkAssertHook)(const char *in_pszExpression, const char *in_pszFileName, int in_lineNumber)
Definition: AkSoundEngine.h:106

이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요