A few shortcuts for simplifying PLC statement construction, and a bigger extension to the expression generator. The latter is explained in more detail below (same as in the commit message).
Reading a value should return a
PlcExpression, while writing a value should be a
While the difference is small, adding a type parameter for the "value" field in the
ExprGenResult class causes havoc throughout the expression code, due to type erasure and my desire not to have to write
ExprGenResult<PlcExpression> everywhere so I can have a handful of
In the end I created two specializations of the
ExprValueResultfor results that read the expression value, and
ExprAddressableResultfor results that modify the expression value.
ExprGenResultis now a base-class without "value" field, with two derived classes
ExpressionGenerator external interface now has
ExprValueResult convertValue(Expression) instead of the old
convertExpr method and
ExprAddressableResult convertAdressable(Expression) for the modifiable variant.
ExpressionGenerator.convertAdressable(Expression)variabnt doesn't handle the
f().fieldcase, but that is fine as it is not addressable in CIF either.
CifDataProvidermethods now has "Value" prefixes (for the existing methods) if the data is meant for reading, and additional "Addressable" variants for modifying discrete and continuous variables. For simplicity I assumed derivative are writable, this may have to change at some point.
DefaultVariableStoragereturns the same PLC variables for CIF variables but that is all still testing code currently.
runValueTest, and an additional
runAdddressableTesthas been added for testing writing to discrete and continuous variables.
Addresses #596 (closed)