123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- #ifndef _AK_OBJECT_H_
- #define _AK_OBJECT_H_
- #include <AK/SoundEngine/Common/AkMemoryMgr.h>
- struct AkPlacementNewKey
- {
-
- AkForceInline AkPlacementNewKey(){}
- };
- AkForceInline void * operator new( size_t , void * memory, const AkPlacementNewKey & ) throw()
- {
- return memory;
- }
- #define AkPlacementNew(_memory) ::new( _memory, AkPlacementNewKey() )
- AkForceInline void operator delete( void *, void *, const AkPlacementNewKey & ) throw() {}
- struct AkPoolNewKey
- {
-
- AkForceInline AkPoolNewKey() {}
- };
- #ifdef AK_MEMDEBUG
- #define AkNew( _pool, _what ) new( ( _pool ), AkPoolNewKey(), __FILE__, __LINE__ ) _what
- #define AkAlloc( _pool, _size ) ( AK::MemoryMgr::dMalloc( ( _pool ), _size, __FILE__, __LINE__ ) )
- #define AkMalign( _pool, _size, _align ) ( AK::MemoryMgr::dMalign( ( _pool ), _size, _align, __FILE__, __LINE__ ) )
- #define AkNewAligned( _pool, _what, _align ) new( ( _pool ), AkPoolNewKey(), ( _align ), __FILE__ , __LINE__ ) _what
- #define AkRealloc( _pool, _pvmem, _size ) ( AK::MemoryMgr::dRealloc( ( _pool ), _pvmem, _size, __FILE__, __LINE__ ) )
- #define AkReallocAligned( _pool, _pvmem, _size, _align ) ( AK::MemoryMgr::dReallocAligned( ( _pool ), _pvmem, _size, _align, __FILE__, __LINE__ ) )
- #else
- #define AkNew( _pool, _what ) new( ( _pool ), AkPoolNewKey() ) _what
- #define AkAlloc( _pool, _size ) ( AK::MemoryMgr::Malloc( ( _pool ), _size ) )
- #define AkMalign( _pool, _size, _align ) ( AK::MemoryMgr::Malign( ( _pool ), _size, _align ) )
- #define AkNewAligned( _pool, _what, _align ) new( ( _pool ), AkPoolNewKey(), ( _align ) ) _what
- #define AkRealloc( _pool, _pvmem, _size ) ( AK::MemoryMgr::Realloc( ( _pool ), _pvmem, _size ) )
- #define AkReallocAligned( _pool, _pvmem, _size, _align ) ( AK::MemoryMgr::ReallocAligned( ( _pool ), _pvmem, _size, _align ) )
- #endif
- #define AkFree( _pool, _pvmem ) ( AK::MemoryMgr::Free( ( _pool ), ( _pvmem ) ) )
- #ifdef AK_MEMDEBUG
- AkForceInline void * operator new( size_t size, AkMemPoolId in_PoolId, const AkPoolNewKey & , const char* szFile, AkUInt32 ulLine ) throw()
- {
- return AK::MemoryMgr::dMalloc( in_PoolId, size, szFile, ulLine );
- }
- AkForceInline void * operator new( size_t size, AkMemPoolId in_PoolId, const AkPoolNewKey &, AkUInt32 in_align, const char* szFile, AkUInt32 ulLine ) throw()
- {
- return AK::MemoryMgr::dMalign( in_PoolId, size, in_align, szFile, ulLine );
- }
- AkForceInline void operator delete( void *, AkMemPoolId, const AkPoolNewKey &, const char*, AkUInt32 ) throw() {}
- AkForceInline void operator delete( void *, AkMemPoolId, const AkPoolNewKey &, AkUInt32, const char*, AkUInt32 ) throw() {}
- #else
- AkForceInline void * operator new( size_t size, AkMemPoolId in_PoolId, const AkPoolNewKey & ) throw()
- {
- return AK::MemoryMgr::Malloc( in_PoolId, size );
- }
- AkForceInline void * operator new( size_t size, AkMemPoolId in_PoolId, const AkPoolNewKey &, AkUInt32 in_align ) throw()
- {
- return AK::MemoryMgr::Malign( in_PoolId, size, in_align );
- }
- AkForceInline void operator delete( void *, AkMemPoolId, const AkPoolNewKey & ) throw() {}
- AkForceInline void operator delete( void *, AkMemPoolId, const AkPoolNewKey &, AkUInt32 ) throw() {}
- #endif
- template <class T>
- AkForceInline void AkDelete( AkMemPoolId in_PoolId, T * in_pObject )
- {
- if ( in_pObject )
- {
- in_pObject->~T();
- AK::MemoryMgr::Free( in_PoolId, in_pObject );
- }
- }
- #endif
|