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

Partial decoding #88

Open
rpopescu opened this issue Nov 22, 2019 · 0 comments
Open

Partial decoding #88

rpopescu opened this issue Nov 22, 2019 · 0 comments

Comments

@rpopescu
Copy link

Hello, and thank you for your work.

I would like to know how to best approach the following scenario, which involves partial decoding of a message when not all input is available. This is actually useful, not just an exercise.
As far as I can tell, I could, using some reasonable assumptions based on the message structure, try to decode it partially. This message is essentially a sequence of segments, and I know that at least some entries will be present in the buffer, so I can check, before decoding each element in a sequence segment, whether enough data remains in the buffer to attempt decoding, or just stop and use what we have decoded so far.
However, I am unsure as to how to use the generated code for this. Is this even possible?
I find it hard to figure out what happens in the generated code accept(Visitor&) methods, which contain code like:
visitor.visit(ext_cref<uint32_cref, copy_operator_tag, properties_type< 2> > ((*this)[0]) );
I would, ideally, like to (in a loop): check remaining input size and if sufficient, attempt to decode another field.
Any clarification on this would be much appreciated.
Thank you.

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

No branches or pull requests

1 participant