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

Marshaling of structs that include repeated fields #2524

Merged
merged 14 commits into from
Apr 11, 2020

Conversation

pleroy
Copy link
Member

@pleroy pleroy commented Apr 10, 2020

  • Add a new class, RepeatedMarshaler, which is a helper referenced by the generated code that marshals a T[] into an array of IntPtr, seen on the C++ side as a T**.
  • Remove support for the (size) field from the generator. We'll use null termination everywhere. The (size) field was the source of a lot of complexity in the generator, and it becomes unmanageable with custom marshalers. While that removal simplifies the generator quite a bit, it changes many parts of it.
  • Remove InBodyParametersMarshaler, it's now replaced by generated code.
  • This was tested in game with RSS by checking the resulting geopotential and using ° for angles.

As usual, there are separate commit for the generated code before/after the changes.

required fixed64 deserializer = 2
[(pointer_to) = "PushDeserializer",
(is_consumed_if) = "serialization->empty()"];
(is_consumed_if) = "*serialization == '\\0'"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::string_view(serialization).empty()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(We might want to change the API so that termination is signalled by serialization == nullptr but that is a job for another pull request.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, but note how this is less efficient (not that we care, I think it's only used when playing a journal).

@eggrobin eggrobin added the LGTM label Apr 10, 2020
@pleroy pleroy merged commit 2d809b3 into mockingbirdnest:master Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants