gwnavruntime/kernel/SF_System.h Source File

SF_System.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 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_System.h
11 Content : General kernel initalization/cleanup, including that
12  of the memory allocator.
13 Created : Ferbruary 5, 2009
14 Authors : Michael Antonov
15 
16 **************************************************************************/
17 
18 #ifndef INC_KY_Kernel_System_H
19 #define INC_KY_Kernel_System_H
20 
22 
23 namespace Kaim {
24 
25 // ***** System Core Initialization class
26 
27 // System initialization must take place before any other KY_Kernel objects are used;
28 // this is done my calling System::Init(). Among other things, this is necessary to
29 // initialize the memory allocator. Similarly, System::Destroy must be
30 // called before program exist for proper clenup. Both of these tasks can be achieved by
31 // simply creating System object first, allowing its constructor/destructor do the work.
32 
33 // Note that for GFx use this class super-seeded by the GFxSystem class, which
34 // should be used instead.
35 
36 class System
37 {
38 public:
39 
40  // Two default argument constructors, to allow specifying KY_SysAllocPaged with and without
41  // HeapDesc for the root heap.
42  KY_EXPORT System(SysAllocBase* psysAlloc = KY_SYSALLOC_DEFAULT_CLASS::InitSystemSingleton())
43  {
44  Init(psysAlloc);
45  }
46  KY_EXPORT System(const MemoryHeap::HeapDesc& rootHeapDesc,
47  SysAllocBase* psysAlloc = KY_SYSALLOC_DEFAULT_CLASS::InitSystemSingleton())
48  {
49  Init(rootHeapDesc, psysAlloc);
50  }
51 
52  KY_EXPORT ~System()
53  {
54  Destroy();
55  }
56 
57  // Initializes System core, setting the global heap that is needed for GFx
58  // memory allocations. Users can override memory heap implementation by passing
59  // a different memory heap here.
60  KY_EXPORT static void KY_CDECL Init(const MemoryHeap::HeapDesc& rootHeapDesc,
61  SysAllocBase* psysAlloc = KY_SYSALLOC_DEFAULT_CLASS::InitSystemSingleton());
62 
63  KY_EXPORT static void KY_CDECL Init(
64  SysAllocBase* psysAlloc = KY_SYSALLOC_DEFAULT_CLASS::InitSystemSingleton())
65  {
66  Init(MemoryHeap::RootHeapDesc(), psysAlloc);
67  }
68 
69  // De-initializes System more, finalizing the threading system and destroying
70  // the global memory allocator.
71  KY_EXPORT static void KY_CDECL Destroy();
72  KY_EXPORT static bool hasMemoryLeaks;
73 };
74 
75 } // Scaleform
76 
77 #endif
Definition: gamekitcrowddispersion.h:20