-
Notifications
You must be signed in to change notification settings - Fork 338
Check if metadata key exists and if so "Remove" before "add" #3611
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
Conversation
@nickbianco for your review/feedback |
@aymanhab, this change seems reasonable, but is there no way to simply update existing metadata values given a key, rather than removing then adding? |
@@ -18,6 +18,9 @@ public static void test_C3DFileAdapter() { | |||
|
|||
// convert data to meters and write a copy | |||
TimeSeriesTableVec3 markerTableInMeters = new TimeSeriesTableVec3(markerTable); | |||
if (markerTableInMeters.hasTableMetaDataKey("Units")) | |||
markerTableInMeters.removeTableMetaDataKey("Units"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the logic in this test necessary given the changes in common.i
?
Edit: nevermind, I see that you implemented both possible changes for comparison.
I think the ideal solution is to add a method like |
Unfortunately the documentation of the method in ValueArrayDictionary.h states |
Oh, weird. That's a poorly named method. Okay, I'm mostly fine with the change, it's just odd to have remove then add to just change a value. One more suggestion: |
@nickbianco I agree about the wierdness ;) Another option is to add new method clearly named e.g. setValueForKeyEvenIfExists? |
@aymanhab, I see, |
Sounds good, thanks @nickbianco 👍 I'll update changelog and then we can merge. |
@aymanhab you should update the test to remove the extra code if you're keeping the |
@nickbianco test failure is another intermittent Moco failure on osx. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One quick change in the CHANGELOG, then LGTM
Thanks @nickbianco |
Fixes issue #3589
Brief summary of changes
Actually it's possible to addMetaData for units but only if it doesn't exist. I modified the test case and the method in bindings to exercise this workflow. Will update the c3dExport file once we agree on what to include.
Testing I've completed
Updated Java test case to change units to Meters
Looking for feedback on...
Whether update the .i file considering that the name of the method starting with "add", or leave alone and update the test code/sample accordingly basically leaving door for future confusion!
CHANGELOG.md (choose one)
This change is