80 std::string
s = std::to_string(
static_cast<long long>(
constValue));
86 size_t dot =
s.find(
'.');
87 if (
dot != std::string::npos)
89 size_t last =
s.find_last_not_of(
'0');
130 j[
"mode"] =
"Variable";
153 if (!data.is_object())
157 if (data.contains(
"mode") && data[
"mode"].is_string())
158 modeStr = data[
"mode"].get<std::string>();
163 if (data.contains(
"value") && data[
"value"].is_string())
169 if (data.contains(
"value") && data[
"value"].is_number())
175 if (data.contains(
"value") && data[
"value"].is_string())
ComponentTypeID GetComponentTypeID_Static()
Defines the Operand type used in condition preset expressions.
< Provides AssetID and INVALID_ASSET_ID
OperandMode
Discriminates which source the operand draws its value from.
@ Variable
References a blackboard variable by ID (string key)
@ Const
Literal numeric constant (double)
@ Pin
External data input pin on the node (identified by label)
One side of a ConditionPreset comparison expression.
double constValue
Literal constant (mode == Const)
static Operand FromJson(const nlohmann::json &data)
Deserializes an Operand from a JSON object.
nlohmann::json ToJson() const
Serializes this Operand to a JSON object.
bool IsVariable() const
Returns true when mode == Variable.
bool IsPin() const
Returns true when mode == Pin.
static Operand CreateVariable(const std::string &variableID)
Factory — creates a Variable-mode operand.
std::string stringValue
Variable ID or Pin label (mode == Variable|Pin)
static Operand CreatePin(const std::string &pinLabel)
Factory — creates a Pin-mode operand.
std::string GetDisplayString() const
Returns a human-readable display string.
static Operand CreateConst(double constVal)
Factory — creates a Const-mode operand.
bool IsConst() const
Returns true when mode == Const.
OperandMode mode
Discriminator tag.
Operand()
Default: Variable mode, empty string.