MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Mcro::Subsystems::Subsystems Namespace Reference

Functions

template<CEngineSubsystem T>
T * Get ()
 
template<CGameInstanceSubsystem T>
T * Get (const UObject *worldContextObject=nullptr, EGameInstanceFallback fallback=EGameInstanceFallback::UseGameViewport, EGetWorldErrorMode errorMode=EGetWorldErrorMode::LogAndReturnNull)
 
template<CLocalPlayerSubsystem T>
T * Get (const UObject *worldContext)
 
template<CWorldSubsystem T>
T * Get (const UObject *worldContext, EGetWorldErrorMode errorMode=EGetWorldErrorMode::LogAndReturnNull)
 
template<CSubsystem T, typename... Args>
T & GetChecked (Args... args)
 
template<CSubsystem T, typename... Args>
T * GetEnsured (Args... args)
 
template<CSubsystem T>
bool ShouldCreateSubsystem (UObject *outer)
 

Function Documentation

◆ Get() [1/4]

template<CEngineSubsystem T>
T * Mcro::Subsystems::Subsystems::Get ( )

Helper for getting a subsystem, the internal boilerplate will be chosen based on the type of subsystem T inherits from. Required arguments may vary depending on the type of subsystem.

Template Parameters
TUEngineSubsystem derivative
Returns
Subsystem if exists or nullptr

Definition at line 55 of file Subsystems.h.

◆ Get() [2/4]

template<CLocalPlayerSubsystem T>
T * Mcro::Subsystems::Subsystems::Get ( const UObject * worldContext)

Helper for getting a subsystem, the internal boilerplate will be chosen based on the type of subsystem T inherits from. Required arguments may vary depending on the type of subsystem.

Template Parameters
TULocalPlayerSubsystem derivative
Returns
Subsystem if exists or nullptr

Definition at line 123 of file Subsystems.h.

◆ Get() [3/4]

template<CWorldSubsystem T>
T * Mcro::Subsystems::Subsystems::Get ( const UObject * worldContext,
EGetWorldErrorMode errorMode = EGetWorldErrorMode::LogAndReturnNull )

Helper for getting a subsystem, the internal boilerplate will be chosen based on the type of subsystem T inherits from. Required arguments may vary depending on the type of subsystem.

Template Parameters
TUWorldSubsystem derivative
Returns
Subsystem if exists or nullptr

Definition at line 140 of file Subsystems.h.

◆ Get() [4/4]

template<CGameInstanceSubsystem T>
T * Mcro::Subsystems::Subsystems::Get ( const UObject * worldContextObject = nullptr,
EGameInstanceFallback fallback = EGameInstanceFallback::UseGameViewport,
EGetWorldErrorMode errorMode = EGetWorldErrorMode::LogAndReturnNull )

Helper for getting a subsystem, the internal boilerplate will be chosen based on the type of subsystem T inherits from. Required arguments may vary depending on the type of subsystem.

Template Parameters
TUGameInstanceSubsystem derivative
Returns
Subsystem if exists or nullptr

Definition at line 68 of file Subsystems.h.

◆ GetChecked()

template<CSubsystem T, typename... Args>
T & Mcro::Subsystems::Subsystems::GetChecked ( Args... args)

Helper for getting a subsystem, the internal boilerplate will be chosen based on the type of subsystem T inherits from. Required arguments may vary depending on the type of subsystem. This is a checked version so if any steps fail to produce the target subsystem the program may crash.

Template Parameters
Ttype of the subsystem
Returns
Guaranteed valid reference to a subsystem

Definition at line 158 of file Subsystems.h.

◆ GetEnsured()

template<CSubsystem T, typename... Args>
T * Mcro::Subsystems::Subsystems::GetEnsured ( Args... args)

Helper for getting a subsystem, the internal boilerplate will be chosen based on the type of subsystem T inherits from. Required arguments may vary depending on the type of subsystem. This is an ensured version so if any steps fail to produce the target subsystem an ensure may be hit.

Template Parameters
Ttype of the subsystem
Returns
Subsystem if exists or nullptr

Definition at line 178 of file Subsystems.h.

◆ ShouldCreateSubsystem()

template<CSubsystem T>
bool Mcro::Subsystems::Subsystems::ShouldCreateSubsystem ( UObject * outer)

Helper for checking if some other subsystem should be created. Useful when you want to make a subsystem which should only be created if some other subsystem should be also created.

Template Parameters
Ttype of the subsystem
Parameters
outerbe sure to pass outer argument which type aligns with checked subsystem outer. This may fail for example if you pass game instance as outer to check for world subsystem existence as ShouldCreateSubsystem of that subsystem may expect the outer to be World.
Returns
True if the target subsystem should be created

Definition at line 199 of file Subsystems.h.