-
-
Notifications
You must be signed in to change notification settings - Fork 422
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
Add an Array variant to DataPack's Read/Write methods #1219
Conversation
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.
While I think the feature is a good idea, I don't think the implementation here is really in spirit with the datapack API which is designed to have some level of type-safety as a counterpoint to the indexed/linear access. This is just packing whatever as an load of cells and relying on the caller to do the right thing.
I think we should have separate CellArray and FloatArray variants (to match the single-element functions, and so we can offer the correct return type back) and the packing should have new internal types added for each which explicitly stores the length of the stored data and the data as a single packed item - thus requiring the caller to match up writing and reading.
So actual arrays instead, I see, I'll look into it |
This takes care of the type safety that was inherent with DataPacks, ensuring you can't perform an array operation on a non-array element, and also that you are performing correct type matching, and you aren't going to underflow the buffer I haven't done throrough testing at all, just enough that determines it to be working with Vector arrays
@asherkin |
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.
A bunch of style review and some other comments inline
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.
Oops; this looks good to me. I'll let a take a last look at it before the 🚢
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.
I think it's weird, that the C++ API has the same type signature for the float and non-float variants. I'd expect it to use a float *
instead of the same datatype and just using a different internal type flag.
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.
Almost there I think! Couple more inlines from me. As the functions are fairly identical pairs I’ve only left comments on one or the other.
Is there anything missing still? |
I have not pen-tested this at all and only did a minimal functionality check with this plugin for proof of concept to handling vectors
With the pandemic going on I've been getting all my projects on the back burner out of the way, this being one of them