版本

menu_open
Wwise SDK 2024.1.0
AkObject.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  Copyright (c) 2024 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 #pragma once
28 
30 
31 //-----------------------------------------------------------------------------
32 // Macros
33 //-----------------------------------------------------------------------------
34 
35 /// Unique structure identifier for AkNew.
37 {
38  /// ctor
40 };
41 
42 #ifdef AK_MEMDEBUG
43  #define AkNew( _pool, _what ) new( ( _pool ), AkPoolNewKey(), __FILE__, __LINE__ ) _what
44  #define AkAlloc( _pool, _size ) ( AK::MemoryMgr::dMalloc( ( _pool ), _size, __FILE__, __LINE__ ) )
45  #define AkMalign( _pool, _size, _align ) ( AK::MemoryMgr::dMalign( ( _pool ), _size, _align, __FILE__, __LINE__ ) )
46  #define AkNewAligned( _pool, _what, _align ) new( ( _pool ), AkPoolNewKey(), ( _align ), __FILE__ , __LINE__ ) _what
47  #define AkRealloc( _pool, _pvmem, _size ) ( AK::MemoryMgr::dRealloc( ( _pool ), _pvmem, _size, __FILE__, __LINE__ ) )
48  #define AkReallocAligned( _pool, _pvmem, _size, _align ) ( AK::MemoryMgr::dReallocAligned( ( _pool ), _pvmem, _size, _align, __FILE__, __LINE__ ) )
49 #else
50  #define AkNew( _pool, _what ) new( ( _pool ), AkPoolNewKey() ) _what
51  #define AkAlloc( _pool, _size ) ( AK::MemoryMgr::Malloc( ( _pool ), _size ) )
52  #define AkMalign( _pool, _size, _align ) ( AK::MemoryMgr::Malign( ( _pool ), _size, _align ) )
53  #define AkNewAligned( _pool, _what, _align ) new( ( _pool ), AkPoolNewKey(), ( _align ) ) _what
54  #define AkRealloc( _pool, _pvmem, _size ) ( AK::MemoryMgr::Realloc( ( _pool ), _pvmem, _size ) )
55  #define AkReallocAligned( _pool, _pvmem, _size, _align ) ( AK::MemoryMgr::ReallocAligned( ( _pool ), _pvmem, _size, _align ) )
56 #endif
57 
58 #define AkFree( _pool, _pvmem ) ( AK::MemoryMgr::Free( ( _pool ), ( _pvmem ) ) )
59 
60 #ifdef AK_MEMDEBUG
61  AkForceInline void * operator new( size_t size, AkMemPoolId in_PoolId, const AkPoolNewKey & , const char* szFile, AkUInt32 ulLine ) throw()
62  {
63  return AK::MemoryMgr::dMalloc( in_PoolId, size, szFile, ulLine );
64  }
65 
66  AkForceInline void * operator new( size_t size, AkMemPoolId in_PoolId, const AkPoolNewKey &, AkUInt32 in_align, const char* szFile, AkUInt32 ulLine ) throw()
67  {
68  return AK::MemoryMgr::dMalign( in_PoolId, size, in_align, szFile, ulLine );
69  }
70 
71  AkForceInline void operator delete( void *, AkMemPoolId, const AkPoolNewKey &, const char*, AkUInt32 ) throw() {}
72  AkForceInline void operator delete( void *, AkMemPoolId, const AkPoolNewKey &, AkUInt32, const char*, AkUInt32 ) throw() {}
73 #else
74  AkForceInline void * operator new( size_t size, AkMemPoolId in_PoolId, const AkPoolNewKey & ) throw()
75  {
76  return AK::MemoryMgr::Malloc( in_PoolId, size );
77  }
78 
79  AkForceInline void * operator new( size_t size, AkMemPoolId in_PoolId, const AkPoolNewKey &, AkUInt32 in_align ) throw()
80  {
81  return AK::MemoryMgr::Malign( in_PoolId, size, in_align );
82  }
83 
84  AkForceInline void operator delete( void *, AkMemPoolId, const AkPoolNewKey & ) throw() {}
85  AkForceInline void operator delete( void *, AkMemPoolId, const AkPoolNewKey &, AkUInt32 ) throw() {}
86 #endif
87 
88 template <class T>
89 AkForceInline void AkDelete( AkMemPoolId in_PoolId, T * in_pObject )
90 {
91  if ( in_pObject )
92  {
93  in_pObject->~T();
94  AK::MemoryMgr::Free( in_PoolId, in_pObject );
95  }
96 }
97 
AKSOUNDENGINE_API void * dMalloc(AkMemPoolId in_poolId, size_t in_uSize, const char *in_pszFile, AkUInt32 in_uLine)
AKSOUNDENGINE_API void * dMalign(AkMemPoolId in_poolId, size_t in_uSize, AkUInt32 in_uAlignment, const char *in_pszFile, AkUInt32 in_uLine)
AKSOUNDENGINE_API void Free(AkMemPoolId in_poolId, void *in_pMemAddress)
AKSOUNDENGINE_API void * Malloc(AkMemPoolId in_poolId, size_t in_uSize)
Unique structure identifier for AkNew.
Definition: AkObject.h:37
AkInt32 AkMemPoolId
Memory pool ID
Definition: AkTypes.h:62
AKSOUNDENGINE_API void * Malign(AkMemPoolId in_poolId, size_t in_uSize, AkUInt32 in_uAlignment)
uint32_t AkUInt32
Unsigned 32-bit integer
AkForceInline void AkDelete(AkMemPoolId in_PoolId, T *in_pObject)
Definition: AkObject.h:89
#define AkForceInline
Definition: AkTypes.h:63
AkForceInline AkPoolNewKey()
ctor
Definition: AkObject.h:39

此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅