real-logic / simple-binary-encoding

Simple Binary Encoding (SBE) - High Performance Message Codec
Apache License 2.0
3.08k stars 519 forks source link

C++ OTF decoder usage and IrCollection crash #65

Closed donmendelson closed 10 years ago

donmendelson commented 10 years ago

Several issues for OTF decoder and IrCollection class.

tmontgomery commented 10 years ago

Back post holidays now. Will take a look at IrCollection crash. Probably just needs a conditional on the destructor.

For 2nd item, I'll expose the underlying multimap by reference via a getter. That way it can be iterated over, etc.

For 3rd item, I can add some wiki usage to clarify. The intention is to grab the buffer offset after the parse and move the pointer (or bump offset) for next decode.

For 4th item, the composite is actually fired. An example is here:

 [exec] IR Filename target/gen/cpp98/Car.sbeir length 4409
 [exec] Reading IR package="baseline"
 [exec]  Header name="messageHeader" length 256
 [exec]  Message name="Car" id="1" version="0" length 4136
 [exec] Encoded filename target/gen/cpp98/Car.data length 131
 [exec] Decoding...
 [exec] Field name="" id=-1, composite name="messageHeader"
 [exec]  name="blockLength" length=1 type=UINT16 value="41" presence=REQUIRED
 [exec]  name="templateId" length=1 type=UINT16 value="1" presence=REQUIRED
 [exec]  name="version" length=1 type=UINT8 value="0" presence=REQUIRED
 [exec]  name="reserved" length=1 type=UINT8 value="0" presence=REQUIRED
 [exec] Message lookup id=1 version 0 offset 6
 [exec] Field name="serialNumber" id=1
 ...

The start of the decode hands back an empty named field that has a composite name. That holds all the fields of the message header.

tmontgomery commented 10 years ago

I've added a wiki page on the usage of the C++ OTF decoder and included an example of decoding multiple messages.

https://github.com/real-logic/simple-binary-encoding/wiki/Cpp-OTF-User-Guide