objectcomputing / mFAST

A FAST (FIX Adapted for STreaming) encoder/decoder
http://objectcomputing.github.io/mFAST
BSD 3-Clause "New" or "Revised" License
224 stars 112 forks source link

Partial decoding #88

Open rpopescu opened 5 years ago

rpopescu commented 5 years ago

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.