Closed stopthatcow closed 3 years ago
Yes.. You are right. Perhaps these functions should be removed altogether?
When I initially wrote fmi4cpp
I thought these functions would be nice to have (and they worked before other parts of the API changed), but in practice they are not so valuable as you want to read as many variables at once for performance reasons using slave->read_XXX(vr, ref)
.
Should read() and write() on typed_scalar_variable be marked as const? Unless they are it seems problematic to make the example code work because as_integer() as_real() and friends return a const type. This makes templating with this type require the use of std::remove_const and an intermediate copy of the underlying description object.
https://github.com/NTNU-IHB/FMI4cpp/blob/70b3b33c79fef23bb41f7f965dfee0cd8d57ce13/include/fmi4cpp/fmi2/xml/typed_scalar_variable.hpp#L102