gwnavruntime/kernel/SF_System.h Source File

SF_System.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 #pragma once
8 
10 
11 namespace Kaim
12 {
13 
14 // ***** System Core Initialization class
15 
16 // System initialization must take place before any other objects are used;
17 // this is done my calling System::Init(). Among other things, this is necessary to
18 // initialize the memory allocator. Similarly, System::Destroy must be
19 // called before program exist for proper cleanup. Both of these tasks can be achieved by
20 // simply creating System object first, allowing its constructor/destructor do the work.
21 class System
22 {
23 public:
24  // Two default argument constructors, to allow specifying KY_SysAllocPaged with and without
25  // HeapDesc for the root heap.
26  System(SysAllocBase* psysAlloc = Kaim::SysAllocMalloc::InitSystemSingleton()) { Init(psysAlloc); }
27 
28  System(const MemoryHeap::HeapDesc& rootHeapDesc, SysAllocBase* sysAllocBase = Kaim::SysAllocMalloc::InitSystemSingleton()) { Init(rootHeapDesc, sysAllocBase); }
29 
30  ~System() { Destroy(); }
31 
32  // Initializes System core, setting the global heap that is needed for GFx
33  // memory allocations. Users can override memory heap implementation by passing
34  // a different memory heap here.
35  static void Init(const MemoryHeap::HeapDesc& rootHeapDesc, SysAllocBase* sysAllocBase = Kaim::SysAllocMalloc::InitSystemSingleton());
36 
37  static void Init(SysAllocBase* sysAllocBase = Kaim::SysAllocMalloc::InitSystemSingleton()) { Init(MemoryHeap::RootHeapDesc(), sysAllocBase); }
38 
39  // De-initializes System more, finalizing the threading system and destroying
40  // the global memory allocator.
41  static void Destroy();
42  static bool hasMemoryLeaks;
43 };
44 }
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17