Plasma Engine  2.0
Loading...
Searching...
No Matches
SubSystem.h
1#pragma once
2
3#include <Foundation/Basics.h>
4#include <Foundation/Utilities/EnumerableClass.h>
5
8{
9 enum Enum
10 {
11 None = -1,
15
16 ENUM_COUNT
17 };
18};
19
28class PL_FOUNDATION_DLL plSubSystem : public plEnumerable<plSubSystem>
29{
30 PL_DECLARE_ENUMERABLE_CLASS(plSubSystem);
31 PL_DISALLOW_COPY_AND_ASSIGN(plSubSystem);
32
33public:
35 {
36 for (plInt32 i = 0; i < plStartupStage::ENUM_COUNT; ++i)
37 m_bStartupDone[i] = false;
38 }
39
40 virtual ~plSubSystem() = default;
41
43 virtual plStringView GetSubSystemName() const = 0;
44
46 virtual plStringView GetGroupName() const = 0;
47
50 virtual plStringView GetDependency(plInt32 iDep) { return {}; }
51
53 plStringView GetPluginName() const { return m_sPluginName; }
54
56 bool IsStartupPhaseDone(plStartupStage::Enum stage) const { return m_bStartupDone[stage]; }
57
58private:
59 // only the startup system may access the following functionality
60 friend class plStartup;
61
63 virtual void OnBaseSystemsStartup() {}
64
66 virtual void OnCoreSystemsStartup() {}
67
69 virtual void OnCoreSystemsShutdown() {}
70
72 virtual void OnHighLevelSystemsStartup() {}
73
76
78 plStringView m_sPluginName;
79
81 bool m_bStartupDone[plStartupStage::ENUM_COUNT];
82};
83
84#include <Foundation/Configuration/StaticSubSystem.h>
Base class to add the ability to another class to enumerate all active instance of it,...
Definition EnumerableClass.h:28
The startup system makes sure to initialize and shut down all known subsystems in the proper order.
Definition Startup.h:77
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
virtual void OnCoreSystemsStartup()
This will be called to initialize the subsystems core components. Can be overridden to handle this ev...
Definition SubSystem.h:66
plStringView GetPluginName() const
Returns the plugin name to which this subsystem belongs.
Definition SubSystem.h:53
virtual void OnBaseSystemsStartup()
This will be called to initialize the subsystems base components. Can be overridden to handle this ev...
Definition SubSystem.h:63
virtual plStringView GetDependency(plInt32 iDep)
Returns a series of strings with the names of the subsystem, which this subsystem depends on....
Definition SubSystem.h:50
bool IsStartupPhaseDone(plStartupStage::Enum stage) const
Returns whether the given startup stage has been done on this subsystem.
Definition SubSystem.h:56
virtual void OnHighLevelSystemsStartup()
This will be called to initialize the subsystems engine / rendering components. Can be overridden to ...
Definition SubSystem.h:72
virtual void OnHighLevelSystemsShutdown()
This will be called to shut down the subsystems engine / rendering components. Can be overridden to h...
Definition SubSystem.h:75
virtual plStringView GetGroupName() const =0
Returns the name of the group to which this subsystem belongs. Must be overridden.
virtual plStringView GetSubSystemName() const =0
Returns the name of the subsystem. Must be overridden.
virtual void OnCoreSystemsShutdown()
This will be called to shut down the subsystems core components. Can be overridden to handle this eve...
Definition SubSystem.h:69
Describes the different stages during startup and shutdown.
Definition SubSystem.h:8
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