Skip to content

Partial decoding #88

Description

@rpopescu

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions