class ConfigVariableManager

Manages all configuration variables in the engine.

Handles loading from config files, applying command-line overrides, and coordinating deferred updates for render-thread-safe variables.

Public

Constructors

ConfigVariableManager

ConfigVariableManager() = default

Methods

~ConfigVariableManager

~ConfigVariableManager() noexcept = default

FindVariable

ConfigVariable *FindVariable(const String &name) const

Finds a configuration variable by name.

name
The name of the variable to find.

Returns: Pointer to the variable, or nullptr if not found.

GetAllVariables

const UnorderedMap<String, ConfigVariable *> &GetAllVariables() const

Returns a map of all registered configuration variables.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Internal

Methods

RegisterVariable

void RegisterVariable(ConfigVariable *variable)

Registers a configuration variable with the manager.

UnregisterVariable

void UnregisterVariable(ConfigVariable *variable)

Unregisters a configuration variable from the manager.

LoadFromFile

bool LoadFromFile(const Path &path)

Loads configuration values from an INI file.

path
Path to the INI file.

Returns: True if the file was loaded successfully, false otherwise.

ApplyCommandLineOverrides

void ApplyCommandLineOverrides()

Applies command-line parameter overrides to matching configuration variables.

Command-line values have higher priority than config file values.

FinalizeInitialization

void FinalizeInitialization()

Marks all variables as initialized, enabling ReadOnly enforcement.

Should be called after config file and command-line processing is complete.

ApplyPendingUpdates

void ApplyPendingUpdates()

Applies any pending deferred updates for RenderThreadSafe variables.

Should be called at frame boundaries when the render thread is idle.

PrintHelp

void PrintHelp() const

Prints information about all registered configuration variables to stdout.

Protected

Methods

OnStartUp

void OnStartUp() override

Override if you want your module to be notified once it has been constructed and started.

~Module<T>

virtual ~Module<T>() = default

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Private

Methods

ParseIniLine

void ParseIniLine(StringView line, u32 lineNumber, const Path &filePath)

Parses a single line from an INI file.

line
The line to parse (as StringView into the file content).
lineNumber
Line number for error reporting.
filePath
File path for error reporting.

staticNormalizeName

static String NormalizeName(StringView name)

Normalizes a variable name for case-insensitive lookup.

Converts the name to lowercase.

StorePendingValue

void StorePendingValue(StringView name, StringView value, ConfigVariableSource source)

Stores a pending value for a variable that hasn't been registered yet.

If a value already exists, it's only overwritten if the new source has higher priority.

ApplyPendingValueIfExists

void ApplyPendingValueIfExists(ConfigVariable *variable, const String &normalizedName)

Applies any pending value for the given variable, if one exists.

Removes the pending value after applying.

Fields

mVariables

UnorderedMap<String, ConfigVariable *> mVariables

mPendingValues

UnorderedMap<String, PendingConfigValue> mPendingValues

mRenderThreadSafeVariables

Vector<ConfigVariable *> mRenderThreadSafeVariables

mMutex

std::mutex mMutex