pub struct ComparisonValue {
pub text: NameId,
pub as_int: Option<i128>,
pub as_float: Option<f64>,
}Expand description
A comparison literal, pre-coerced at load time.
XTCE does not type the value attribute of a <Comparison>, and the reference
implementation resolves that by coercing the literal to type(parsed_value) on every
evaluation — so an enumerated parameter compares as text and an integer one as a number.
Which of those applies cannot be known from the schema alone, because a calibrator turns
an integer-encoded parameter into a float.
Rather than predict it, every reading that could apply is computed once here, at load time. Evaluation then picks the one matching the value it actually got, and never parses inside the packet loop.
Fields§
§text: NameIdThe literal exactly as written, for error messages and text comparisons.
as_int: Option<i128>The literal read as an integer, if it is one.
as_float: Option<f64>The literal read as a float, if it is one.