Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Olympe::OperandRef Struct Reference

References one operand of a condition (left or right). More...

#include <ConditionRef.h>

Public Types

enum class  Mode { Variable , Const , Pin }
 Discriminates the data source of this operand. More...
 

Public Member Functions

nlohmann::json ToJson () const
 Serializes this OperandRef to a JSON object.
 

Static Public Member Functions

static OperandRef FromJson (const nlohmann::json &data)
 Deserializes an OperandRef from a JSON object.
 

Public Attributes

Mode mode = Mode::Const
 Active mode.
 
std::string variableName
 Blackboard key (mode == Variable), e.g. "mHealth".
 
std::string constValue
 Literal string (mode == Const), e.g. "100.0".
 
std::string dynamicPinID
 UUID of the DynamicDataPin that supplies this operand's value.
 

Detailed Description

References one operand of a condition (left or right).

If mode is Pin, dynamicPinID stores the UUID of the DynamicDataPin generated on the node by DynamicDataPinManager::RegeneratePinsFromConditions(). If mode is Variable or Const, no pin is generated and dynamicPinID is left empty.

Definition at line 43 of file ConditionRef.h.

Member Enumeration Documentation

◆ Mode

Discriminates the data source of this operand.

Enumerator
Variable 

References a blackboard variable by name.

Const 

Literal constant value.

Pin 

External data-input pin on the owning node.

Definition at line 46 of file ConditionRef.h.

Member Function Documentation

◆ FromJson()

OperandRef Olympe::OperandRef::FromJson ( const nlohmann::json data)
static

Deserializes an OperandRef from a JSON object.

Definition at line 40 of file ConditionRef.cpp.

References Const, GetComponentTypeID_Static(), mode, Pin, and Variable.

Referenced by Olympe::ConditionRef::FromJson().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToJson()

nlohmann::json Olympe::OperandRef::ToJson ( ) const

Serializes this OperandRef to a JSON object.

Definition at line 20 of file ConditionRef.cpp.

References Const, constValue, dynamicPinID, GetComponentTypeID_Static(), mode, Pin, Variable, and variableName.

Referenced by Olympe::ConditionRef::ToJson().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ constValue

std::string Olympe::OperandRef::constValue

Literal string (mode == Const), e.g. "100.0".

Definition at line 57 of file ConditionRef.h.

Referenced by Olympe::NodeConditionsPanel::RenderOperandDropdown(), and ToJson().

◆ dynamicPinID

std::string Olympe::OperandRef::dynamicPinID

UUID of the DynamicDataPin that supplies this operand's value.

Populated by DynamicDataPinManager::RegeneratePinsFromConditions() when the parent ConditionRef is registered with a Pin-mode operand. Format: "pin_inst_<random>", e.g. "pin_inst_abc123def456". Empty string means no pin has been assigned yet.

Definition at line 68 of file ConditionRef.h.

Referenced by Olympe::NodeConditionsPanel::RenderOperandDropdown(), and ToJson().

◆ mode

Mode Olympe::OperandRef::mode = Mode::Const

Active mode.

Definition at line 53 of file ConditionRef.h.

Referenced by FromJson(), Olympe::NodeConditionsPanel::RenderOperandDropdown(), and ToJson().

◆ variableName

std::string Olympe::OperandRef::variableName

Blackboard key (mode == Variable), e.g. "mHealth".

Definition at line 56 of file ConditionRef.h.

Referenced by Olympe::NodeConditionsPanel::RenderConditionsPreview(), Olympe::NodeConditionsPanel::RenderOperandDropdown(), and ToJson().


The documentation for this struct was generated from the following files: