载入中...
搜索中...
未找到
Condition.h
浏览该文件的文档.
109[[nodiscard]] EVENGINE_API_FOUNDATION const char* conditionReasonCodeName(ConditionReasonCode code) noexcept;
118[[nodiscard]] EVENGINE_API_FOUNDATION const char* conditionKindName(ConditionKind kind) noexcept;
127[[nodiscard]] EVENGINE_API_FOUNDATION const char* compareOperatorName(CompareOperator op) noexcept;
136class EVENGINE_API_FOUNDATION [[nodiscard("ConditionResult must be inspected before the decision is used")]]
142 static ConditionResult failed(ConditionReasonCode reason, Value evidence = {}, Value details = Value::Object{});
240 const std::optional<ScriptConditionDeclaration>& scriptDeclaration() const noexcept { return scriptDeclaration_; }
Owning, renderer-independent dynamic values.
Explain one condition evaluation in a UI- and log-friendly form.
Definition Condition.h:137
ConditionReasonCode reasonCode() const noexcept
Stable machine-readable reason code.
Definition Condition.h:147
const Value & evidence() const noexcept
Observed value or child evidence owned by this result.
Definition Condition.h:149
const Value & details() const noexcept
Structured details suitable for UI explanation.
Definition Condition.h:151
const std::vector< Condition > & children() const noexcept
Return owned children; empty for a leaf node.
Definition Condition.h:230
const Value & arguments() const noexcept
Return owned PolicyCall arguments.
Definition Condition.h:238
Condition()=default
Construct an empty All node, which passes vacuously.
CompareOperator compareOperator() const noexcept
Return the comparison operator used by Compare.
Definition Condition.h:234
const Value & expected() const noexcept
Return the expected value owned by Compare.
Definition Condition.h:236
const std::optional< ScriptConditionDeclaration > & scriptDeclaration() const noexcept
Return an optional script dependency/determinism declaration.
Definition Condition.h:240
const std::string & key() const noexcept
Return the key/name used by a leaf, if applicable.
Definition Condition.h:232
Read-only state boundary used by every condition evaluation.
Definition Condition.h:175
virtual ~EvaluationContext()=default
Releases EvaluationContext resources.
virtual std::optional< Value > value(std::string_view key) const =0
Query a named scalar or structured value for Compare nodes.
virtual std::optional< ConditionResult > policy(std::string_view name, const Value &arguments) const =0
Evaluate a named read-only policy with owned arguments.
Definition Condition.cpp:7
ConditionReasonCode
Stable machine-readable explanation code for a condition outcome.
Definition Condition.h:82
@ ValueMismatch
@ MissingValue
@ TagUnavailable
@ InvalidCondition
@ NoChildPassed
@ PolicyUnavailable
@ PolicyRejected
@ StateMissing
@ TagMissing
@ ResourceMissing
@ StateMismatch
@ ChildFailed
@ AuthorityDenied
@ AttributeMissing
@ AuthorityUnavailable
const char * conditionKindName(ConditionKind kind) noexcept
Return the stable lowercase spelling of a condition node kind. @ownership Borrowed process-static tex...
Definition Condition.cpp:107
const char * conditionReasonCodeName(ConditionReasonCode code) noexcept
Return the stable lowercase spelling of a condition reason code. @ownership Borrowed process-static t...
Definition Condition.cpp:84
@ PolicyCall
DeterminismLevel
Determinism contract declared by a script-backed condition policy.
Definition Condition.h:47
@ ToleranceBounded
Results may vary within a documented numeric tolerance.
@ TickDeterministic
Deterministic when evaluated at the injected simulation tick.
@ BitExact
Same inputs produce the same bits without an external clock.
@ ExplicitlyNondeterministic
Result is intentionally not suitable for replay or lockstep.
@ Exists
Passes when the keyed value is present; expected is ignored.
@ GreaterEqual
@ LessEqual
const char * compareOperatorName(CompareOperator op) noexcept
Return the stable lowercase spelling of a comparison operator. @ownership Borrowed process-static tex...
Definition Condition.cpp:118
Definition Container.h:602
Metadata a script policy must declare before it is used by a condition.
Definition Condition.h:65
std::vector< std::string > dependencies
Logical state/query names read by the policy.
Definition Condition.h:69