![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
C++14-compliant type-safe value container for task parameters. More...
#include <TaskGraphTypes.h>
Collaboration diagram for Olympe::TaskValue:Classes | |
| union | PodData |
Public Member Functions | |
| TaskValue () | |
| Default constructor: creates a value of type VariableType::None. | |
| TaskValue (bool v) | |
| Construct from bool. | |
| TaskValue (int v) | |
| Construct from int. | |
| TaskValue (float v) | |
| Construct from float. | |
| TaskValue (const ::Vector &v) | |
| Construct from Vector. | |
| TaskValue (EntityID v) | |
| Construct from EntityID. | |
| TaskValue (const std::string &v) | |
| Construct from std::string. | |
| bool | AsBool () const |
| Returns the bool value. | |
| int | AsInt () const |
| Returns the int value. | |
| float | AsFloat () const |
| Returns the float value. | |
| ::Vector | AsVector () const |
| Returns the Vector value. | |
| EntityID | AsEntityID () const |
| Returns the EntityID value. | |
| std::string | AsString () const |
| Returns the string value. | |
| VariableType | GetType () const |
| Returns the VariableType tag of the stored value. | |
| bool | IsNone () const |
| Returns true if the value has not been set (type == None). | |
| std::string | to_string () const |
| Converts the stored value to a string representation. | |
Private Attributes | |
| union Olympe::TaskValue::PodData | m_data |
| ::Vector | m_vectorValue |
| std::string | m_stringValue |
| VariableType | m_type |
C++14-compliant type-safe value container for task parameters.
Stores one value of type: bool, int, float, Vector, EntityID, or std::string. POD types share a union; non-POD types (Vector, std::string) are stored as separate members.
Throws std::runtime_error on type mismatch when calling typed getters.
Definition at line 181 of file TaskGraphTypes.h.
| Olympe::TaskValue::TaskValue | ( | ) |
Default constructor: creates a value of type VariableType::None.
Definition at line 22 of file TaskGraphTypes.cpp.
References Olympe::TaskValue::PodData::entityValue, and m_data.
|
explicit |
Construct from bool.
| v | Boolean value. |
Definition at line 30 of file TaskGraphTypes.cpp.
References Olympe::TaskValue::PodData::boolValue, GetComponentTypeID_Static(), and m_data.
Here is the call graph for this function:
|
explicit |
Construct from int.
| v | Integer value. |
Definition at line 38 of file TaskGraphTypes.cpp.
References GetComponentTypeID_Static(), Olympe::TaskValue::PodData::intValue, and m_data.
Here is the call graph for this function:
|
explicit |
Construct from float.
| v | Float value. |
Definition at line 46 of file TaskGraphTypes.cpp.
References Olympe::TaskValue::PodData::floatValue, GetComponentTypeID_Static(), and m_data.
Here is the call graph for this function:Construct from Vector.
| v | Vector value (2D or 3D via z component). |
Definition at line 54 of file TaskGraphTypes.cpp.
References Olympe::TaskValue::PodData::entityValue, and m_data.
|
explicit |
Construct from EntityID.
| v | Entity identifier. |
Definition at line 62 of file TaskGraphTypes.cpp.
References Olympe::TaskValue::PodData::entityValue, GetComponentTypeID_Static(), and m_data.
Here is the call graph for this function:
|
explicit |
Construct from std::string.
| v | String value. |
Definition at line 70 of file TaskGraphTypes.cpp.
References Olympe::TaskValue::PodData::entityValue, and m_data.
| bool Olympe::TaskValue::AsBool | ( | ) | const |
Returns the bool value.
| std::runtime_error | if the stored type is not Bool. |
Definition at line 82 of file TaskGraphTypes.cpp.
References Olympe::Bool, Olympe::TaskValue::PodData::boolValue, m_data, and m_type.
Referenced by Olympe::ConditionEvaluator::CompareValues(), Olympe::EntityBlackboard::ExportGlobalsToJson(), Olympe::VSGraphExecutor::HandleBranch(), Olympe::VSGraphExecutor::HandleWhile(), Olympe::PopulateRuntimeEnvironmentFromBlackboard(), Olympe::PopulateRuntimeEnvironmentFromDataPins(), Olympe::VisualScriptEditorPanel::RenderConstValueInput(), Olympe::VisualScriptEditorPanel::RenderGlobalVariablesPanel(), and Olympe::VisualScriptEditorPanel::SerializeAndWrite().
Here is the caller graph for this function:| EntityID Olympe::TaskValue::AsEntityID | ( | ) | const |
Returns the EntityID value.
| std::runtime_error | if the stored type is not EntityID. |
Definition at line 118 of file TaskGraphTypes.cpp.
References Olympe::EntityID, Olympe::TaskValue::PodData::entityValue, m_data, and m_type.
Referenced by Olympe::Task_Attack::ExecuteWithContext(), Olympe::EntityBlackboard::ExportGlobalsToJson(), and Olympe::VisualScriptEditorPanel::RenderGlobalVariablesPanel().
Here is the caller graph for this function:| float Olympe::TaskValue::AsFloat | ( | ) | const |
Returns the float value.
| std::runtime_error | if the stored type is not Float. |
Definition at line 100 of file TaskGraphTypes.cpp.
References Olympe::Float, Olympe::TaskValue::PodData::floatValue, m_data, and m_type.
Referenced by Olympe::ConditionEvaluator::CompareValues(), Olympe::EntityBlackboard::ExportGlobalsToJson(), Olympe::VSGraphExecutor::HandleMathOp(), Olympe::PopulateRuntimeEnvironmentFromBlackboard(), Olympe::PopulateRuntimeEnvironmentFromDataPins(), Olympe::VisualScriptEditorPanel::RenderConstValueInput(), and Olympe::VisualScriptEditorPanel::RenderGlobalVariablesPanel().
Here is the caller graph for this function:| int Olympe::TaskValue::AsInt | ( | ) | const |
Returns the int value.
| std::runtime_error | if the stored type is not Int. |
Definition at line 91 of file TaskGraphTypes.cpp.
References Olympe::Int, Olympe::TaskValue::PodData::intValue, m_data, and m_type.
Referenced by Olympe::ConditionEvaluator::CompareValues(), Olympe::Task_Compare::ExecuteWithContext(), Olympe::EntityBlackboard::ExportGlobalsToJson(), Olympe::PopulateRuntimeEnvironmentFromBlackboard(), Olympe::PopulateRuntimeEnvironmentFromDataPins(), Olympe::VisualScriptEditorPanel::RenderConstValueInput(), and Olympe::VisualScriptEditorPanel::RenderGlobalVariablesPanel().
Here is the caller graph for this function:| std::string Olympe::TaskValue::AsString | ( | ) | const |
Returns the string value.
| std::runtime_error | if the stored type is not String. |
Definition at line 127 of file TaskGraphTypes.cpp.
References m_stringValue, m_type, and Olympe::String.
Referenced by Olympe::ConditionEvaluator::CompareValues(), Olympe::Task_ChangeState::ExecuteWithContext(), Olympe::EntityBlackboard::ExportGlobalsToJson(), Olympe::VSGraphExecutor::HandleSwitch(), Olympe::VisualScriptEditorPanel::RenderConstValueInput(), and Olympe::VisualScriptEditorPanel::RenderGlobalVariablesPanel().
Here is the caller graph for this function:| Vector Olympe::TaskValue::AsVector | ( | ) | const |
Returns the Vector value.
| std::runtime_error | if the stored type is not Vector. |
Definition at line 109 of file TaskGraphTypes.cpp.
References m_type, m_vectorValue, and Olympe::Vector.
Referenced by Olympe::ConditionEvaluator::CompareValues(), Olympe::Task_Flee::ExecuteWithContext(), Olympe::Task_GotoPosition::ExecuteWithContext(), Olympe::EntityBlackboard::ExportGlobalsToJson(), and Olympe::VisualScriptEditorPanel::RenderConstValueInput().
Here is the caller graph for this function:| VariableType Olympe::TaskValue::GetType | ( | ) | const |
Returns the VariableType tag of the stored value.
Definition at line 140 of file TaskGraphTypes.cpp.
References m_type.
Referenced by Olympe::GlobalTemplateBlackboard::AddVariable(), Olympe::ConditionEvaluator::CompareValues(), Olympe::EntityBlackboard::ExportGlobalsToJson(), Olympe::PopulateRuntimeEnvironmentFromBlackboard(), Olympe::PopulateRuntimeEnvironmentFromDataPins(), Olympe::EntityBlackboard::SetGlobalValue(), Olympe::LocalBlackboard::SetValue(), and Olympe::GlobalTemplateBlackboard::UpdateVariable().
Here is the caller graph for this function:| bool Olympe::TaskValue::IsNone | ( | ) | const |
Returns true if the value has not been set (type == None).
Definition at line 145 of file TaskGraphTypes.cpp.
References m_type, and Olympe::None.
Referenced by Olympe::GlobalTemplateBlackboard::AddVariable(), Olympe::EntityBlackboard::ExportGlobalsToJson(), Olympe::VisualScriptEditorPanel::RenderConstValueInput(), Olympe::VisualScriptEditorPanel::RenderGlobalVariablesPanel(), and Olympe::GlobalTemplateBlackboard::UpdateVariable().
Here is the caller graph for this function:| std::string Olympe::TaskValue::to_string | ( | ) | const |
Converts the stored value to a string representation.
Never returns an empty string — falls back to "0" for None or empty values. This prevents JSON builder failures when serializing uninitialized entries.
Definition at line 154 of file TaskGraphTypes.cpp.
References Olympe::Bool, Olympe::TaskValue::PodData::boolValue, Olympe::EntityID, Olympe::TaskValue::PodData::entityValue, Olympe::Float, Olympe::TaskValue::PodData::floatValue, GetComponentTypeID_Static(), Olympe::Int, Olympe::TaskValue::PodData::intValue, m_data, m_stringValue, m_type, Olympe::None, Olympe::String, and SYSTEM_LOG.
Referenced by Olympe::VisualScriptEditorPanel::FormatTaskParameters(), and Olympe::VisualScriptEditorPanel::RunGraphSimulation().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Referenced by AsBool(), AsEntityID(), AsFloat(), AsInt(), TaskValue(), TaskValue(), TaskValue(), TaskValue(), TaskValue(), TaskValue(), TaskValue(), and to_string().
|
private |
Definition at line 306 of file TaskGraphTypes.h.
Referenced by AsString(), and to_string().
|
private |
Definition at line 308 of file TaskGraphTypes.h.
Referenced by AsBool(), AsEntityID(), AsFloat(), AsInt(), AsString(), AsVector(), GetType(), IsNone(), and to_string().
|
private |
Definition at line 305 of file TaskGraphTypes.h.
Referenced by AsVector().