gwnavruntime/basesystem/basesystem.h Source File

basesystem.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 #pragma once
9 
15 
16 namespace Kaim
17 {
18 
19 class PerfCounterManager;
20 class IPerfMarkerInterface;
21 
41 {
42 public:
44  enum InitializationLogLevel { InitializationLogLevel_None, InitializationLogLevel_Normal, InitializationLogLevel_Detailled };
45 
47  : m_defaultLogToMode(DefaultLog::LogToAll)
48  , m_log(nullptr)
49  , m_perfMarkerInterface(nullptr)
50  , m_sysAlloc(nullptr)
51  , m_rootHeapDesc(nullptr)
53  , m_initSymbolTable(false)
54  , m_initializationLogLevel(InitializationLogLevel_None)
55  {}
56 
57 public:
58 
61  DefaultLog::LogToMode m_defaultLogToMode;
62 
68 
73 
74  // memory allocation
82  MemoryHeap::HeapDesc* m_rootHeapDesc;
83 
87 
91 
95 };
96 
97 
107 {
108 public:
110 
111 public:
114 
116  BaseSystem(const Config& config) { Init(config); }
117 
120 
122  static void Init(const Config& config)
123  {
124  CheckHeaderLibDesync::Check(); // Creates "unresolved external symbol" link error in case of failure.
125  DoInit(config); // do the "real" init
126  }
127 
129  static bool IsInitialized() { return s_isInitialized; }
130 
133  static bool HasMemoryLeaks() { return System::hasMemoryLeaks; }
134 
136  static void Destroy();
137 
138 private:
139  static void DoInit(const Config& config);
140  static void DestroyMemorySystemAndLog();
141  static void RegisterBlobs();
142 
143 private:
144  static bool s_isInitialized;
145 };
146 
147 } // namespace Kaim
148 
149 
Default implementation of the BaseLog interface.
Definition: defaultlog.h:26
The BaseSystemConfig class contains a set of objects and configuration parameters that are required i...
Definition: basesystem.h:40
static void Check()
This is called in user code thanks to BaseSystem::Init.
Definition: checkheaderlibdesync.h:45
IPerfMarkerInterface * m_perfMarkerInterface
Provides an instance of a custom class that implements IPerfMarkerInterface.
Definition: basesystem.h:72
BaseLog * m_log
Provides an instance of class that derives from Log, which Autodesk Navigation components will invoke...
Definition: basesystem.h:67
A base class for an object that manages memory allocations and de-allocations.
Definition: SF_SysAlloc.h:18
bool m_useStackRegistryToTrackAllocations
The StackRegistry class allows to record and output the call-stacks for any leaks that remain after t...
Definition: basesystem.h:86
static bool HasMemoryLeaks()
Indicates whether or not any memory allocated by the BaseSystem remains to be freed.
Definition: basesystem.h:133
static void Destroy()
Destroys the BaseSystem.
Definition: basesystem.cpp:133
BaseSystem(const Config &config)
Creates and sets up the BaseSystem according to the specified configuration.
Definition: basesystem.h:116
bool m_initSymbolTable
This flag controls whether or not the StackRegistry calls SymInitialize() and SymCleanup().
Definition: basesystem.h:90
InitializationLogLevel
Controls the log level to use in the function BaseSystem::Init()
Definition: basesystem.h:44
BaseSystemConfig Config
Defines a type for the configuration object used to initialize the BaseSystem.
Definition: basesystem.h:109
DefaultLog::LogToMode m_defaultLogToMode
Specifies the output locations in which the BaseSystem will print debug messages when using its defau...
Definition: basesystem.h:61
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
static void Init(const Config &config)
Sets up the BaseSystem according to the specified configuration.
Definition: basesystem.h:122
SysAllocBase * m_sysAlloc
Provides an instance of a class that implements the SysAlloc interface, which will be invoked any tim...
Definition: basesystem.h:81
static bool IsInitialized()
Indicates whether or not the BaseSystem has been successfully initialized.
Definition: basesystem.h:129
In Navigation, BaseLog MUST be used instead of Kaim::Log.
Definition: baselog.h:18
InitializationLogLevel m_initializationLogLevel
Controls the log level to use in the function BaseSystem::Init().
Definition: basesystem.h:94
The BaseSystem provides Autodesk Navigation components with a set of objects used for memory allocati...
Definition: basesystem.h:106
BaseSystem()
Creates and sets up the new BaseSystem with a default configuration.
Definition: basesystem.h:113
~BaseSystem()
Calls static function BaseSystem::Destroy()
Definition: basesystem.h:119
An abstract interface for performance tracking markers.
Definition: iperfmarkerinterface.h:18