Skip to content

[C#] Add Offsets and WrapForEncodeAndApplyHeader #777

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
May 4, 2020

Conversation

szehetner
Copy link
Contributor

This adds two new members to the generated C# messages. Both of these are already available in the generated Java classes, but were missing in the C# version.

public const int <FieldMember>Offset
This is useful if you need to read/write a member with some other method than the generated accessors, e.g. read a fixed-length byte array as a ReadOnlySpan<byte>. Currently these offsets need to be hardcoded.

public void WrapForEncodeAndApplyHeader(DirectBuffer buffer, int offset, MessageHeader headerEncoder)
Generates the repetitive code to fill the header. Same as "wrapAndApplyHeader" in Java.

@vyazelenko
Copy link
Contributor

@szehetner The build fails with the Checkstyle error, i.e.:

sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/csharp/CSharpGenerator.java:1038: Line is longer than 120 characters (found 137). [LineLength]

@szehetner
Copy link
Contributor Author

@vyazelenko Thanks, forgot to run the full gradle build locally.

@mjpt777 mjpt777 merged commit 6cd1a11 into aeron-io:master May 4, 2020
@szehetner szehetner deleted the csharp-api branch May 5, 2020 06:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants