class TConfigVariable

template<typename T>
Inherits: ConfigVariable

Represents a globally accessible variable that can be configured from command line, config files, or at runtime.

Template parameters

T

The value type (bool, i32, u32, or float).

Public

Constructors

TConfigVariable<T>

TConfigVariable<T>(const char *name, const char *description, T defaultValue, ConfigVariableFlags flags = ConfigVariableFlag::None)

Creates a new configuration variable and registers it with the manager.

name
The unique name for this variable (e.g., "render.vsync").
description
A human-readable description of what this variable controls.
defaultValue
The default value if not set from config or command line.
flags
Optional flags controlling behavior (RenderThreadSafe, ReadOnly).

TConfigVariable

TConfigVariable(const char *name, const char *description, bool defaultValue, ConfigVariableFlags flags)

Creates a new configuration variable and registers it with the manager.

name
The unique name for this variable (e.g., "render.vsync").
description
A human-readable description of what this variable controls.
defaultValue
The default value if not set from config or command line.
flags
Optional flags controlling behavior (RenderThreadSafe, ReadOnly).

TConfigVariable

TConfigVariable(const char *name, const char *description, int defaultValue, ConfigVariableFlags flags)

Creates a new configuration variable and registers it with the manager.

name
The unique name for this variable (e.g., "render.vsync").
description
A human-readable description of what this variable controls.
defaultValue
The default value if not set from config or command line.
flags
Optional flags controlling behavior (RenderThreadSafe, ReadOnly).

TConfigVariable

TConfigVariable(const char *name, const char *description, unsigned int defaultValue, ConfigVariableFlags flags)

Creates a new configuration variable and registers it with the manager.

name
The unique name for this variable (e.g., "render.vsync").
description
A human-readable description of what this variable controls.
defaultValue
The default value if not set from config or command line.
flags
Optional flags controlling behavior (RenderThreadSafe, ReadOnly).

TConfigVariable

TConfigVariable(const char *name, const char *description, float defaultValue, ConfigVariableFlags flags)

Creates a new configuration variable and registers it with the manager.

name
The unique name for this variable (e.g., "render.vsync").
description
A human-readable description of what this variable controls.
defaultValue
The default value if not set from config or command line.
flags
Optional flags controlling behavior (RenderThreadSafe, ReadOnly).

Methods

~TConfigVariable<T>

Get

inline T Get() const

Returns the current value.

This is always a simple atomic load with no branching, fast to access.

GetDefault

inline T GetDefault() const

Returns the default value that was specified at construction.

Set

bool Set(T value)

Sets a new value at runtime.

value
The new value to set.

Returns: True if the value was set, false if the variable is ReadOnly.

GetValueAsString

String GetValueAsString() const override

Returns the current value formatted as a string.

GetDefaultValueAsString

String GetDefaultValueAsString() const override

Returns the default value formatted as a string.

GetTypeName

const char *GetTypeName() const override

Returns the type name of this variable (e.g., "bool", "i32").

~TConfigVariable

~TConfigVariable<bool>() noexcept

Get

inline bool Get() const

Returns the current value.

This is always a simple atomic load with no branching, fast to access.

GetDefault

inline bool GetDefault() const

Returns the default value that was specified at construction.

Set

bool Set(bool value)

Sets a new value at runtime.

value
The new value to set.

Returns: True if the value was set, false if the variable is ReadOnly.

GetValueAsString

String GetValueAsString() const override

Returns the current value formatted as a string.

GetDefaultValueAsString

String GetDefaultValueAsString() const override

Returns the default value formatted as a string.

GetTypeName

const char *GetTypeName() const override

Returns the type name of this variable (e.g., "bool", "i32").

~TConfigVariable

~TConfigVariable<i32>() noexcept

Get

inline int Get() const

Returns the current value.

This is always a simple atomic load with no branching, fast to access.

GetDefault

inline int GetDefault() const

Returns the default value that was specified at construction.

Set

bool Set(int value)

Sets a new value at runtime.

value
The new value to set.

Returns: True if the value was set, false if the variable is ReadOnly.

GetValueAsString

String GetValueAsString() const override

Returns the current value formatted as a string.

GetDefaultValueAsString

String GetDefaultValueAsString() const override

Returns the default value formatted as a string.

GetTypeName

const char *GetTypeName() const override

Returns the type name of this variable (e.g., "bool", "i32").

~TConfigVariable

~TConfigVariable<u32>() noexcept

Get

inline unsigned int Get() const

Returns the current value.

This is always a simple atomic load with no branching, fast to access.

GetDefault

inline unsigned int GetDefault() const

Returns the default value that was specified at construction.

Set

bool Set(unsigned int value)

Sets a new value at runtime.

value
The new value to set.

Returns: True if the value was set, false if the variable is ReadOnly.

GetValueAsString

String GetValueAsString() const override

Returns the current value formatted as a string.

GetDefaultValueAsString

String GetDefaultValueAsString() const override

Returns the default value formatted as a string.

GetTypeName

const char *GetTypeName() const override

Returns the type name of this variable (e.g., "bool", "i32").

~TConfigVariable

~TConfigVariable<float>() noexcept

Get

inline float Get() const

Returns the current value.

This is always a simple atomic load with no branching, fast to access.

GetDefault

inline float GetDefault() const

Returns the default value that was specified at construction.

Set

bool Set(float value)

Sets a new value at runtime.

value
The new value to set.

Returns: True if the value was set, false if the variable is ReadOnly.

GetValueAsString

String GetValueAsString() const override

Returns the current value formatted as a string.

GetDefaultValueAsString

String GetDefaultValueAsString() const override

Returns the default value formatted as a string.

GetTypeName

const char *GetTypeName() const override

Returns the type name of this variable (e.g., "bool", "i32").

Operators

operator type-parameter-0-0

inline operator T() const

Implicit conversion to the value type for convenient usage.

operator bool

inline operator bool() const

Implicit conversion to the value type for convenient usage.

operator int

inline operator int() const

Implicit conversion to the value type for convenient usage.

operator unsigned int

inline operator unsigned int() const

Implicit conversion to the value type for convenient usage.

operator float

inline operator float() const

Implicit conversion to the value type for convenient usage.

Private

Methods

ApplyPendingUpdate

void ApplyPendingUpdate() override

Called by ConfigVariableManager to apply any pending deferred updates.

SetFromString

bool SetFromString(const String &value, ConfigVariableSource source) override

Sets the value from a string representation.

value
The string value to parse.
source
The source of this value (for priority handling).

Returns: True if the value was successfully set, false otherwise.

SetValueWithoutChecks

void SetValueWithoutChecks(T value, ConfigVariableSource source)

Internal method to set the value, bypassing ReadOnly checks.

Used during initialization from config file or command line.

ApplyPendingUpdate

void ApplyPendingUpdate() override

Called by ConfigVariableManager to apply any pending deferred updates.

SetFromString

bool SetFromString(const String &value, ConfigVariableSource source) override

Sets the value from a string representation.

value
The string value to parse.
source
The source of this value (for priority handling).

Returns: True if the value was successfully set, false otherwise.

SetValueWithoutChecks

void SetValueWithoutChecks(bool value, ConfigVariableSource source)

Internal method to set the value, bypassing ReadOnly checks.

Used during initialization from config file or command line.

ApplyPendingUpdate

void ApplyPendingUpdate() override

Called by ConfigVariableManager to apply any pending deferred updates.

SetFromString

bool SetFromString(const String &value, ConfigVariableSource source) override

Sets the value from a string representation.

value
The string value to parse.
source
The source of this value (for priority handling).

Returns: True if the value was successfully set, false otherwise.

SetValueWithoutChecks

void SetValueWithoutChecks(int value, ConfigVariableSource source)

Internal method to set the value, bypassing ReadOnly checks.

Used during initialization from config file or command line.

ApplyPendingUpdate

void ApplyPendingUpdate() override

Called by ConfigVariableManager to apply any pending deferred updates.

SetFromString

bool SetFromString(const String &value, ConfigVariableSource source) override

Sets the value from a string representation.

value
The string value to parse.
source
The source of this value (for priority handling).

Returns: True if the value was successfully set, false otherwise.

SetValueWithoutChecks

void SetValueWithoutChecks(unsigned int value, ConfigVariableSource source)

Internal method to set the value, bypassing ReadOnly checks.

Used during initialization from config file or command line.

ApplyPendingUpdate

void ApplyPendingUpdate() override

Called by ConfigVariableManager to apply any pending deferred updates.

SetFromString

bool SetFromString(const String &value, ConfigVariableSource source) override

Sets the value from a string representation.

value
The string value to parse.
source
The source of this value (for priority handling).

Returns: True if the value was successfully set, false otherwise.

SetValueWithoutChecks

void SetValueWithoutChecks(float value, ConfigVariableSource source)

Internal method to set the value, bypassing ReadOnly checks.

Used during initialization from config file or command line.

Fields

mValue

std::atomic<T> mValue

mDefaultValue

T mDefaultValue

mPendingValue

std::atomic<T> mPendingValue

mHasPendingUpdate

std::atomic<bool> mHasPendingUpdate

mValue

std::atomic<bool> mValue

mDefaultValue

bool mDefaultValue

mPendingValue

std::atomic<bool> mPendingValue

mHasPendingUpdate

std::atomic<bool> mHasPendingUpdate

mValue

std::atomic<int> mValue

mDefaultValue

int mDefaultValue

mPendingValue

std::atomic<int> mPendingValue

mHasPendingUpdate

std::atomic<bool> mHasPendingUpdate

mValue

std::atomic<unsigned int> mValue

mDefaultValue

unsigned int mDefaultValue

mPendingValue

std::atomic<unsigned int> mPendingValue

mHasPendingUpdate

std::atomic<bool> mHasPendingUpdate

mValue

std::atomic<float> mValue

mDefaultValue

float mDefaultValue

mPendingValue

std::atomic<float> mPendingValue

mHasPendingUpdate

std::atomic<bool> mHasPendingUpdate