Plasma Engine  2.0
Loading...
Searching...
No Matches
Startup.h
1#pragma once
2
3#include <Foundation/Configuration/Plugin.h>
4#include <Foundation/Configuration/SubSystem.h>
5#include <Foundation/Containers/Deque.h>
6
7#define PL_GLOBALEVENT_STARTUP_CORESYSTEMS_BEGIN "plStartup_StartupCoreSystems_Begin"
8#define PL_GLOBALEVENT_STARTUP_CORESYSTEMS_END "plStartup_StartupCoreSystems_End"
9#define PL_GLOBALEVENT_SHUTDOWN_CORESYSTEMS_BEGIN "plStartup_ShutdownCoreSystems_Begin"
10#define PL_GLOBALEVENT_SHUTDOWN_CORESYSTEMS_END "plStartup_ShutdownCoreSystems_End"
11
12#define PL_GLOBALEVENT_STARTUP_HIGHLEVELSYSTEMS_BEGIN "plStartup_StartupHighLevelSystems_Begin"
13#define PL_GLOBALEVENT_STARTUP_HIGHLEVELSYSTEMS_END "plStartup_StartupHighLevelSystems_End"
14#define PL_GLOBALEVENT_SHUTDOWN_HIGHLEVELSYSTEMS_BEGIN "plStartup_ShutdownHighLevelSystems_Begin"
15#define PL_GLOBALEVENT_SHUTDOWN_HIGHLEVELSYSTEMS_END "plStartup_ShutdownHighLevelSystems_End"
16
17#define PL_GLOBALEVENT_UNLOAD_PLUGIN_BEGIN "plStartup_UnloadPlugin_Begin"
18#define PL_GLOBALEVENT_UNLOAD_PLUGIN_END "plStartup_UnloadPlugin_End"
19
76class PL_FOUNDATION_DLL plStartup
77{
78public:
79 // 'Base Startup' happens even before 'Core Startup', but only really low level stuff should be done there
80 // and those subsystems should not have any dependencies on each other.
81 // 'Base Startup' is automatically done right before 'Core Startup'
82 // There is actually no 'Base Shutdown', everything that is initialized in 'Base Startup' should not require
83 // any explicit shutdown.
84
95 static void AddApplicationTag(const char* szTag);
96
98 static bool HasApplicationTag(const char* szTag);
99
106
112
119
127
134
136 static void PrintAllSubsystems();
137
141 static void ReinitToCurrentState();
142
143private:
149 static void UnloadPluginSubSystems(plStringView sPluginName);
150
151 static void PluginEventHandler(const plPluginEvent& EventData);
152 static void AssignSubSystemPlugin(plStringView sPluginName);
153
154 static void ComputeOrder(plDeque<plSubSystem*>& Order);
155 static bool HasDependencyOnPlugin(plSubSystem* pSubSystem, plStringView sModule);
156
157 static void Startup(plStartupStage::Enum stage);
158 static void Shutdown(plStartupStage::Enum stage);
159
160 static bool s_bPrintAllSubSystems;
161 static plStartupStage::Enum s_CurrentState;
162 static plDynamicArray<const char*> s_ApplicationTags;
163};
Definition Deque.h:270
Definition DynamicArray.h:81
The startup system makes sure to initialize and shut down all known subsystems in the proper order.
Definition Startup.h:77
static void StartupBaseSystems()
Runs the 'base' startup sequence of all subsystems in the proper order.
Definition Startup.h:105
static void StartupCoreSystems()
Runs the 'core' startup sequence of all subsystems in the proper order.
Definition Startup.h:111
static void ShutdownHighLevelSystems()
Runs the 'high level' shutdown sequence of all subsystems in the proper order (reversed startup order...
Definition Startup.h:133
static void StartupHighLevelSystems()
Runs the 'high level' startup sequence of all subsystems in the proper order.
Definition Startup.h:126
static void ShutdownCoreSystems()
Runs the 'core' shutdown sequence of all subsystems in the proper order (reversed startup order).
Definition Startup.h:118
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Base class for all subsystems.
Definition SubSystem.h:29
The data that is broadcast whenever a plugin is (un-) loaded.
Definition Plugin.h:11
Enum
Definition SubSystem.h:10
@ CoreSystems
In this stage the core functionality is being started / shut down.
Definition SubSystem.h:13
@ BaseSystems
In this stage the absolute base functionality is started. This should only be used by the Foundation ...
Definition SubSystem.h:12
@ HighLevelSystems
In this stage the higher level functionality, which depends on a rendering context,...
Definition SubSystem.h:14