You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #472 we added support for overriding the data for lookups and data variables at runtime. This was implemented primarily to support the use case of supplying game inputs at runtime.
For the EPS model, @ToddFincannonEI has been maintaining a fork of SDE for a similar use case where they need to be able to override lookups at runtime. In their case however, they need to be able to reset a lookup back to its original data (i.e., the data in the generated model that was used to initialize the native Lookup instance). Additionally they would like to avoid malloc/free where possible for performance reasons.
When I implemented #472, I didn't include support for the "reset to original" use case (since it wasn't needed for the gaming mode use case), but with a few incremental changes we should be able to refactor the existing implementation to make that reset behavior work.
The text was updated successfully, but these errors were encountered:
In my implementation of #472, I made the "override lookups" case work by disposing the existing Lookup instance and creating a new one (for both the C and JS runtimes).
Since we now want to be able to preserve the original lookup data, the new approach will be to add a __set_lookup function (for the C runtime) and a JsModelLookup.setData method (for the JS runtime). The implementation is largely the same for both C and JS. We now allow the data/points parameter to be NULL/undefined. In the instance state, we now keep separate references for the original data and the dynamic (set at runtime) data. Calling __set_lookup with a non-NULL data buffer will copy that data into an internally managed buffer, and will make the dynamic data buffer the "active" one. Calling __set_lookup again with a NULL data buffer will switch the internal state back so that the original data buffer is the "active" one.
In the compile package, I am changing code gen for the setLookup function so that it calls __set_lookup or lookup.setData instead of doing the replace (dispose+create) like before.
In the runtime package, I am making the following changes:
Changed LookupDef and createLookupDef so that points is allowed to be undefined
Changed encoding/decoding of LookupDef to handle the case where points is undefined
Added JsModelLookup.setData and reworked the implementation of JsModelLookup to behave like its C counterpart
I updated the unit tests to cover these changes, and also updated the existing override-lookups integration test to verify the case of resetting a lookup.
In #472 we added support for overriding the data for lookups and data variables at runtime. This was implemented primarily to support the use case of supplying game inputs at runtime.
For the EPS model, @ToddFincannonEI has been maintaining a fork of SDE for a similar use case where they need to be able to override lookups at runtime. In their case however, they need to be able to reset a lookup back to its original data (i.e., the data in the generated model that was used to initialize the native
Lookup
instance). Additionally they would like to avoid malloc/free where possible for performance reasons.When I implemented #472, I didn't include support for the "reset to original" use case (since it wasn't needed for the gaming mode use case), but with a few incremental changes we should be able to refactor the existing implementation to make that reset behavior work.
The text was updated successfully, but these errors were encountered: