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::MathOpOperand Struct Reference

Represents one arithmetic operand (left A, right B) in a MathOp node. More...

#include <MathOpOperand.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 MathOpOperand to a JSON object.
 

Static Public Member Functions

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

Public Attributes

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

Detailed Description

Represents one arithmetic operand (left A, right B) in a MathOp node.

Similar to OperandRef from ConditionRef.h, but adapted for arithmetic operations. If mode is Pin, dynamicPinID stores the UUID of the DynamicDataPin. If mode is Variable or Const, no pin is generated and dynamicPinID is empty.

Definition at line 36 of file MathOpOperand.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 39 of file MathOpOperand.h.

Member Function Documentation

◆ FromJson()

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

Deserializes a MathOpOperand from a JSON object.

Definition at line 32 of file MathOpOperand.cpp.

References GetComponentTypeID_Static(), and mode.

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

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

◆ ToJson()

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

Serializes this MathOpOperand to a JSON object.

Definition at line 14 of file MathOpOperand.cpp.

References constValue, dynamicPinID, GetComponentTypeID_Static(), mode, and variableName.

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

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

Member Data Documentation

◆ constValue

std::string Olympe::MathOpOperand::constValue

◆ dynamicPinID

std::string Olympe::MathOpOperand::dynamicPinID

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

Populated by DynamicDataPinManager when the parent MathOpOperand 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 61 of file MathOpOperand.h.

Referenced by Olympe::MathOpRef::GetDisplayString(), and ToJson().

◆ mode

Mode Olympe::MathOpOperand::mode = Mode::Const

◆ variableName

std::string Olympe::MathOpOperand::variableName

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