-
Notifications
You must be signed in to change notification settings - Fork 25
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
Improve Zserio Encoding Guide for packed arrays #677
Comments
May I ask what language you are targetting? Just out of curiousity 😃 |
I'm toying around with Rust |
Further findings (don't wanna open new issues for every new thing i encounter)
|
Then you might want to check out https://github.com/Danaozhong/rust-zserio |
Packing of compound types is unfortunatelly pretty complicated. Just documenting this is a time-consuming task in itself.
You can imagine this that some temporary array with all presented values are created, then this array is delta compressed and then the compressed elements are used in the corresponded place of the original array. Example:
Let's suppose that the
Inner packable arrays are automatically packed as well.
Inner packed arrays are handled in the same way as outer arrays. There is no difference between fixed, variable length and auto arrays.
Not sure if I undestand this correctly but if compound type is not packable and such compound type is used as an element in the packed array, then the packing is completely ignored and the array will be encoded as an unpacked array. In other words, the
Unions and choices are handled in the same way than optionals. For choices it means that all fields corresponded to the same case are considered as an temporary arrays. For unions, it means that all fields are considered as an temporary arrays. Example:
Let's suppose that the I agree that we should improve Zserio Encoding Guide but because of our capacity we are not able to do it quickly. If my brief explanation does not help and if this is a blocker for you, then I would suggest making a quick call. |
Thank you very much for this report. You are right, we will improve the Zserio Language Overview document. New issue #679 has been created because of that. |
None of this is a blocker, this is merely a private toy project and if absolutely necessary i can figure this out by consulting the existing Extensions. Nevertheless explicit documentation always is preferable.
So the Language Overview states the following:
On the other hand the Encoding Guide states:
So to me this reads that both documents disagree on the handling of below code.
|
OK, I see your point. We will extend Language Overview to explicitly state that PackableStructure is packable if at least one its field is packable. Or something similar. |
Trying to create my own extension for the zserio generator and i'm struggling a bit with packed arrays.
According to the Zserio Language Overview following types can be packed:
The first 3 bulletpoints more or less correspond to integer values.
For compound types i am not quite clear on their working:
integer types, enumeration, bitmask types or inner packable arrays
are not packable, but the encoding guide uses examples with string and non-packable types as being inlined without PackingDescriptorHow are unions handled? They are always considered packable because of their tag, but what does this mean for the actual value, e.g. array[0] contains union with field1 = 1, and array[1] contains union with field2 = 5?
I found this sentence but an example would be really useful (also mentions choices, which are not listed as packable in the language overview)
The text was updated successfully, but these errors were encountered: