-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor limit handling #273
Conversation
Section 7.3.6.5 of the ASAM ODX specification defines how strings, bytearrays and numeric objects ought to be compared, and the proceedure for bytearrays is not completely intuitive. This has some consequences for testing the applicability of limits. Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Michael Hahn <[email protected]>
also, use it at the places where compu scales are tested. Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Michael Hahn <[email protected]>
this is surprisingly difficult: the problem is that the LIMIT tag does not specify the data type (integer, float, string, bytefield) which the limit is about but the limit obviously needs to know that type in order to do something. The solution taken here is to pass the type of the limit's value to the `from_et()` method as an extra argument. For Multiplexer cases where even the type of the limit's value is not known when the limit must be created, (this is only known after the switch key reference has been resolved) the method `Limit.set_value_type()` is added. Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Michael Hahn <[email protected]>
9d2fab1
to
893a02a
Compare
i.e., 0.2.2 . this one started complaining about renamed configuration options. Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Michael Hahn <[email protected]>
893a02a
to
6f1e172
Compare
Does the limit really need to know its data type during creation? The datatype can be simply passed as argument to |
not during creation, but as soon as it must check if a value adheres to the specified limit.
I considered doing that. It turns out that this implies that the limit value must be converted from string each and every time which a limit is checked (and the code felt quite clunky and "footgunny" because one can easily pass the wrong type to these methods...) |
thanks to [at]kayoub5 for the finds. Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Michael Hahn <[email protected]>
@kayoub5: Do you think that this can be merged? |
today, we set out to clean up the limit handling code. this is surprisingly difficult: the problem is that the LIMIT tag does not specify the data type (integer, float, string, bytefield) which the limit is about but the limit obviously needs to know that type in order to do something. The solution taken here is to pass the type of the limit's value to the
from_et()
method as an extra argument. For multiplexer cases where even the type of the limit's value is not known when the limit must be instantiated, (this is only known after the reference to the switch key has been resolved) the methodLimit.set_value_type()
is added.Andreas Lauser <[email protected]>, on behalf of MBition GmbH.
Provider Information