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

Generate noChoicesSet convenience method for Sets #575

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants