Skip to content

Generate noChoicesSet convenience method for Sets #575

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 2 commits into from
Jul 28, 2018

Conversation

JerryShea
Copy link
Contributor

The decoder generated for a Set does not provide a convenience method to determine if nothing has been set. If we look at sbe_samples and Car's OptionalExtras, the only way to determine if no OptionalExtras
have been set is to call

    notSet = ! (sunRoof() || sportsPack() || cruiseControl());

And this code is fragile and inefficient. This PR modifies SbeTool to generate a new method in OptionalExtrasDecoder

    public boolean noChoicesSet()
    {
        return 0 == buffer.getByte(offset);
    }

@mjpt777
Copy link
Contributor

mjpt777 commented Jul 28, 2018

This could be a useful feature. Would make sense to call it something more like isEmpty() and it also needs to include taking care of the null value when optional.

@mjpt777 mjpt777 merged commit 3655cbf into aeron-io:master Jul 28, 2018
@mjpt777
Copy link
Contributor

mjpt777 commented Jul 28, 2018

Please run the full build to ensure it passes.

@JerryShea
Copy link
Contributor Author

Woops - fixed now.

# 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.

2 participants