Class Parameters
Generic parameter container with type-safe runtime access. More...
#include <Parameters.h>
Classes
| Type | Name |
|---|---|
| struct | ParaData Internal storage for parameter value and range. |
Public Attributes
| Type | Name |
|---|---|
| bool | is_para_changed Dirty flag indicating value changed since last read. |
| ParaData | para_data Actual value storage. |
| std::string | para_name Human-readable parameter name (displayed in UI ) |
| ParaType | para_type Runtime type discriminator. |
Public Functions
| Type | Name |
|---|---|
| Parameters | GenParaItem (ParaType type) Generates a new parameter item of specified type. |
| T & | Get () Type-safe accessor for parameter value. |
| ParaData * | GetParaPtr () Returns pointer to internal parameter data. |
| Parameters () Constructs a default parameter with no type. |
|
| Parameters (ParaType _type, const std::string & _name="unknown param") Constructs a parameter with specified type and name. |
|
| void | Rename (const std::string & name) Renames the parameter. |
| ~Parameters () Destroys the parameter. |
Detailed Description
Parameters encapsulates a named, typed value with optional range constraints. It uses std::variant for type erasure, allowing heterogeneous parameter collections to be stored in containers. The Get<T>() template accessor provides type-safe retrieval with automatic type checking.
Dirty Flag: * is_para_changed tracks whether value has been modified since last read * Consumer code should reset flag after processing change
Range Constraints: * data_range defines min/max bounds for numeric parameters * UI layer uses this to configure slider ranges * Enforcement is UI-side (not validated in Parameters itself)
Note:
Thread-safety: Not thread-safe. Access from main thread only.
Note:
Type conversion: Get<T>() will default-initialize if type mismatch occurs.
Public Attributes Documentation
variable is_para_changed
Dirty flag indicating value changed since last read.
bool Parameters::is_para_changed;
variable para_data
Actual value storage.
ParaData Parameters::para_data;
variable para_name
Human-readable parameter name (displayed in UI )
std::string Parameters::para_name;
variable para_type
Runtime type discriminator.
ParaType Parameters::para_type;
Public Functions Documentation
function GenParaItem
Generates a new parameter item of specified type.
Parameters Parameters::GenParaItem (
ParaType type
)
Parameters:
typeType for the new parameter
Returns:
New Parameters instance with specified type
Note:
Used for creating parameter collections programmatically.
function Get
Type-safe accessor for parameter value.
template<typename T>
T & Parameters::Get ()
Template parameters:
TExpected type (must match variant alternatives)
Returns:
Reference to stored value (default-initialized if type mismatch)
Note:
If T doesn't match stored type, value is replaced with T(0).
function GetParaPtr
Returns pointer to internal parameter data.
inline ParaData * Parameters::GetParaPtr ()
Returns:
Pointer to ParaData for direct access
Note:
Use with caution; prefer Get<T>() for type safety.
function Parameters [1/2]
Constructs a default parameter with no type.
Parameters::Parameters ()
Note:
Type is NONE_PARA until assigned.
function Parameters [2/2]
Constructs a parameter with specified type and name.
Parameters::Parameters (
ParaType _type,
const std::string & _name="unknown param"
)
Parameters:
_typeParameter type (FLOAT_PARA, VEC3_PARA, etc.)_nameHuman-readable parameter name for UI display
function Rename
Renames the parameter.
inline void Parameters::Rename (
const std::string & name
)
Parameters:
nameNew display name for UI
function ~Parameters
Destroys the parameter.
Parameters::~Parameters ()
The documentation for this class was generated from the following file src/compo/Parameters.h