Skip to content
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

Implement new zserio type 'bytes' #448

Closed
mikir opened this issue Nov 8, 2022 · 0 comments
Closed

Implement new zserio type 'bytes' #448

mikir opened this issue Nov 8, 2022 · 0 comments
Assignees
Labels
c++ C++ language generator core Zserio core module doc HTML documentation generator documentation Documentation change is needed enhancement New feature or request java Java language generator python Python language generator xml XML generator
Milestone

Comments

@mikir
Copy link
Contributor

mikir commented Nov 8, 2022

Currently, if there is a need to model array of bytes, it is possible to use zserio array of uint8:

struct BytesArray
{
    uint8 bytesArray[];
};

However, such construct has the mapping to the native languages which does not have to be optimal for users:

  • C++: std::vector<uint8_t>
  • Java: short[]
  • Python: typing.List[int]

For example, Java users might want special mapping to byte[] and Python users might want special mapping to bytearray. In another words, users might want zserio type which just mean some array of bytes not array of numbers. This might be useful, e.g. for images. Therefore, we suggest to implement new zserio type bytes.

Comparing to current extern zserio type, new zserio type bytes will store number of bytes (not bits) as a varsize before array during serialization. This could potentially save some bits because varsize can encode small values more efficiently.

Mapping will be as follows:

  • C++: std::vector<uint8_t>
  • Java: byte[]
  • Python: bytearray
@mikir mikir added enhancement New feature or request python Python language generator java Java language generator documentation Documentation change is needed core Zserio core module c++ C++ language generator doc HTML documentation generator xml XML generator labels Nov 8, 2022
@mikir mikir added this to the 2.9 milestone Nov 8, 2022
Mi-La added a commit that referenced this issue Nov 16, 2022
Mi-La added a commit that referenced this issue Nov 16, 2022
Mi-La added a commit that referenced this issue Nov 18, 2022
Mi-La added a commit that referenced this issue Nov 21, 2022
@Mi-La Mi-La closed this as completed Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ C++ language generator core Zserio core module doc HTML documentation generator documentation Documentation change is needed enhancement New feature or request java Java language generator python Python language generator xml XML generator
Projects
None yet
Development

No branches or pull requests

2 participants