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 PlcVarExpression.
As suggested in !600 (closed) I generalized
ExprGenResult<E extends PlcExpression> with type
E for the
ExprGenResult.value and added again
PlcAddressableResult as derived classes.
This mostly works, except for dumping lists of either derived class into the constructor for copying the code and variables. You must make a copy to
List<ExprGenResult<?>>. Alternatively you can use a
List<ExprGenResult<?>> immediately for the parent results but then the
value becomes unusable.
The problem may be solvable by adding constructors for both
List<PlcAddressableResult> cases in both derived classes at least. Not a very nice solution though.
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)variant doesn't handle the f().field case, but that is fine as it is not addressable in CIF either.
CifDataProvider methods 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.
DefaultVariableStorage returns 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)