-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Background
Sometimes we want to run a match criteria against the parameter that is currently being parsed in order to determine which calibrator to use. This isn't explicitly provided for in XTCE but it isn't disallowed either. In our Comparison implementation, we allow the evaluate method to take an optional argument for the current_parsed_value, which is not yet recorded in the Packet dict. If the comparison evaluation fails to find the referenced parameter in the Packet dict, it assumes that the comparison should be against the value currently being parsed.
Implementation
Track Current Parameter in Packet
It's annoying that Comparison.evaluate() doesn't actually know which parameter (name) is currently being parsed and just assumes that if the parameter reference isn't in the Packet dict, then it must be the current parameter being parsed.
Add an instance attribute or property to Packet that stores at least the name of the Parameter currently being parsed. This will allow the Comparison to actually know that it's evaluating against the correct parameter instead of there simply being an error in the packet definition.
Allow Current Value in Condition
Allow this same type of behavior on a Condition element - i.e. referencing the parameter currently being parsed as part of the Condition. This will allow behavior such as "If CURRENT_PARAMETER value is less than OTHER_PARAMETER value, then use calibrator X on CURRENT_PARAMETER". Remember that either side of the Condition could be the current parsed value.