![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
One side of a ConditionPreset comparison expression. More...
#include <Operand.h>
Public Member Functions | |
| Operand () | |
| Default: Variable mode, empty string. | |
| std::string | GetDisplayString () const |
| Returns a human-readable display string. | |
| bool | IsPin () const |
| Returns true when mode == Pin. | |
| bool | IsVariable () const |
| Returns true when mode == Variable. | |
| bool | IsConst () const |
| Returns true when mode == Const. | |
| nlohmann::json | ToJson () const |
| Serializes this Operand to a JSON object. | |
Static Public Member Functions | |
| static Operand | CreateVariable (const std::string &variableID) |
| Factory — creates a Variable-mode operand. | |
| static Operand | CreateConst (double constVal) |
| Factory — creates a Const-mode operand. | |
| static Operand | CreatePin (const std::string &pinLabel) |
| Factory — creates a Pin-mode operand. | |
| static Operand | FromJson (const nlohmann::json &data) |
| Deserializes an Operand from a JSON object. | |
Public Attributes | |
| OperandMode | mode |
| Discriminator tag. | |
| std::string | stringValue |
| Variable ID or Pin label (mode == Variable|Pin) | |
| double | constValue |
| Literal constant (mode == Const) | |
One side of a ConditionPreset comparison expression.
Only one of stringValue / constValue is meaningful depending on mode:
| Olympe::Operand::Operand | ( | ) |
Default: Variable mode, empty string.
Definition at line 21 of file Operand.cpp.
Factory — creates a Const-mode operand.
| constVal | Literal numeric value. |
Definition at line 43 of file Operand.cpp.
References Olympe::Const, constValue, GetComponentTypeID_Static(), mode, and stringValue.
Referenced by Olympe::ConditionPresetEditDialog::ConditionPresetEditDialog(), Olympe::ConditionPresetEditDialog::ConditionPresetEditDialog(), Olympe::Examples::Example1_SimpleHealthCheck(), Olympe::Examples::Example2_ConstModeOperand(), Olympe::Examples::Example6_ErrorHandling(), Olympe::ConditionPresetLibraryPanel::OnAddPresetClicked(), Olympe::ConditionPresetEditDialog::RenderOperandSelector(), Olympe::ConditionPresetEditDialog::SetLeftConst(), Olympe::ConditionPresetEditDialog::SetLeftMode(), Olympe::ConditionPresetEditDialog::SetRightConst(), and Olympe::ConditionPresetEditDialog::SetRightMode().
Here is the call graph for this function:
Here is the caller graph for this function:Factory — creates a Pin-mode operand.
| pinLabel | Pin label shown in the UI (e.g. "Pin:1"). |
Definition at line 53 of file Operand.cpp.
References constValue, GetComponentTypeID_Static(), mode, Olympe::Pin, and stringValue.
Referenced by Olympe::ConditionPresetEditDialog::RenderOperandSelector(), Olympe::ConditionPresetEditDialog::SetLeftMode(), Olympe::ConditionPresetEditDialog::SetLeftPin(), Olympe::ConditionPresetEditDialog::SetRightMode(), and Olympe::ConditionPresetEditDialog::SetRightPin().
Here is the call graph for this function:
Here is the caller graph for this function:Factory — creates a Variable-mode operand.
| variableID | Blackboard variable key (e.g. "mHealth"). |
Definition at line 33 of file Operand.cpp.
References constValue, GetComponentTypeID_Static(), mode, stringValue, and Olympe::Variable.
Referenced by Olympe::ConditionPresetEditDialog::ConditionPresetEditDialog(), Olympe::ConditionPresetEditDialog::ConditionPresetEditDialog(), Olympe::Examples::Example1_SimpleHealthCheck(), Olympe::Examples::Example6_ErrorHandling(), Olympe::ConditionPresetLibraryPanel::OnAddPresetClicked(), Olympe::ConditionPresetEditDialog::RenderOperandSelector(), Olympe::ConditionPresetEditDialog::SetLeftMode(), Olympe::ConditionPresetEditDialog::SetLeftVariable(), Olympe::ConditionPresetEditDialog::SetRightMode(), and Olympe::ConditionPresetEditDialog::SetRightVariable().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Deserializes an Operand from a JSON object.
| data | JSON object (must contain "mode" and "value" keys). |
Definition at line 149 of file Operand.cpp.
References Olympe::Const, constValue, GetComponentTypeID_Static(), mode, Olympe::Pin, stringValue, and Olympe::Variable.
Referenced by Olympe::ConditionPreset::FromJson().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Olympe::Operand::GetDisplayString | ( | ) | const |
Returns a human-readable display string.
Examples: "[mHealth]", "[2]", "[Pin:1]"
Definition at line 66 of file Operand.cpp.
References Olympe::Const, constValue, GetComponentTypeID_Static(), mode, Olympe::Pin, stringValue, and Olympe::Variable.
Referenced by Olympe::ConditionPreset::GetPreview().
Here is the call graph for this function:
Here is the caller graph for this function:| bool Olympe::Operand::IsConst | ( | ) | const |
Returns true when mode == Const.
Definition at line 114 of file Operand.cpp.
References Olympe::Const, and mode.
| bool Olympe::Operand::IsPin | ( | ) | const |
Returns true when mode == Pin.
Definition at line 104 of file Operand.cpp.
References mode, and Olympe::Pin.
Referenced by Olympe::ConditionPreset::GetPinNeeds(), Olympe::ConditionPreset::NeedsLeftPin(), and Olympe::ConditionPreset::NeedsRightPin().
Here is the caller graph for this function:| bool Olympe::Operand::IsVariable | ( | ) | const |
Returns true when mode == Variable.
Definition at line 109 of file Operand.cpp.
References mode, and Olympe::Variable.
| nlohmann::json Olympe::Operand::ToJson | ( | ) | const |
Serializes this Operand to a JSON object.
Definition at line 123 of file Operand.cpp.
References Olympe::Const, constValue, GetComponentTypeID_Static(), mode, Olympe::Pin, stringValue, and Olympe::Variable.
Referenced by Olympe::ConditionPreset::ToJson().
Here is the call graph for this function:
Here is the caller graph for this function:| double Olympe::Operand::constValue |
Literal constant (mode == Const)
Definition at line 48 of file Operand.h.
Referenced by CreateConst(), CreatePin(), CreateVariable(), FromJson(), GetDisplayString(), and ToJson().
| OperandMode Olympe::Operand::mode |
Discriminator tag.
Definition at line 46 of file Operand.h.
Referenced by CreateConst(), CreatePin(), CreateVariable(), FromJson(), GetDisplayString(), IsConst(), IsPin(), IsVariable(), and ToJson().
| std::string Olympe::Operand::stringValue |
Variable ID or Pin label (mode == Variable|Pin)
Definition at line 47 of file Operand.h.
Referenced by Olympe::NodeConditionsPanel::AddCondition(), CreateConst(), CreatePin(), CreateVariable(), FromJson(), GetDisplayString(), and ToJson().