gwnavruntime/kernel/SF_HeapNew.h Source File

SF_HeapNew.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 /**************************************************************************
8 
9 PublicHeader: Kernel
10 Filename : KY_HeapNew.h
11 Content : Defines heap allocation macros such as KY_HEAP_NEW, etc.
12 Created : September 9, 2008
13 Authors : Michael Antonov, Maxim Shemanarev
14 
15 Notes : This file should be included in internal headers and
16  source files but NOT the public headers because it
17  #undefines operator new. It is separated from Memory
18  for this reason.
19 
20 **************************************************************************/
21 
23 
24 // Operator 'new' must NOT be defined, or the macros below will not compile
25 // correctly (compiler would complain about the number of macro arguments).
26 #undef new
27 
28 #ifndef INC_KY_Kernel_HeapNew_H
29 #define INC_KY_Kernel_HeapNew_H
30 
31 
32 // Define heap macros
33 #ifdef KY_MEMORY_ENABLE_DEBUG_INFO
34 
35 #define KY_HEAP_NEW(heap) new(heap,__FILE__,__LINE__)
36 #define KY_HEAP_NEW_ID(heap,id) new(heap, id, __FILE__,__LINE__)
37 #define KY_HEAP_AUTO_NEW(addr) new((Kaim::MemAddressPtr)((void*)addr),__FILE__,__LINE__)
38 // Global new
39 #define KY_NEW new(__FILE__,__LINE__)
40 
41 #else
42 
43 #define KY_HEAP_NEW(pheap) new(pheap)
44 #define KY_HEAP_NEW_ID(pheap,id) new(pheap,id)
45 #define KY_HEAP_AUTO_NEW(paddr) new((Kaim::MemAddressPtr)((void*)paddr))
46 #define KY_NEW new
47 
48 #endif
49 
50 
51 #endif // INC_KY_HEAPNEW_H