open-dis-cpp
open-dis-cpp copied to clipboard
DIS7 - SetDataPdu - Access to _variableDatums
How can I access to the raw data inside the variable datum? Looking at the code I am a little confused. I mean SetDataPdu contains a std::vector<VariableDatum> and I can access to it but inside the VariableDatum I found the following
/** Type of variable datum to be transmitted. 32 bit enumeration defined in EBV */
unsigned int _variableDatumID;
/** Length, in bits, of the variable datum. */
unsigned int _variableDatumLength;
/** Variable datum. This can be any number of bits long, depending on the datum. */
unsigned int _variableDatumBits;
/** padding to put the record on a 64 bit boundary */
unsigned int _padding;
// Variable Data
std::vector<EightByteChunk> _variableDatums;
Looking on the standard, AFAIK or let me say as far as I understand, I don't see reference to EightByteChunk _variableDatums even if you marshal and unmarshall it, but no accessor method are provided.... Am I missing something? How does it is supposed to be used? For Java impl a getVariableData method exist, here (c++) how can I access the same data?
Also the getMarshalledSize seems to be wrong.
C++ looks like:
marshalSize = marshalSize + 4; // _variableDatumID
marshalSize = marshalSize + 4; // _variableDatumLength
marshalSize = marshalSize + 4; // _variableDatumBits
marshalSize = marshalSize + 4; // _padding
Java looks like:
marshalSize = marshalSize + 4; // variableDatumID
marshalSize = marshalSize + 4; // variableDatumLength
marshalSize = marshalSize + payload.length; // payload length
marshalSize = marshalSize + padding.length; // padding
For c++ seems we can add only 4 bytes.... Regards
I would like to inform that I am working on a fork trying to fix those issues I found with DIS7. When I will be ready i will ask for a merge request.
@quonn77 I think you're on the right track. Quite a bit of work was done to improve the Java and C++ language implementations, but this may be one of those cases where an improvement was done in one language and not the other yet. If that's the case here, I suggest trying to backport the change done to the Java SetDataPdu into the C++ SetDataPdu. And yes a pull request would be very welcome!
It seems like you've found your way around already, but for my own sake I'll leave a few links here as references.
- The C++ SetDataPdu class - https://github.com/open-dis/open-dis-cpp/blob/master/src/dis6/SetDataPdu.cpp
- The Java SetDataPdu class - https://github.com/open-dis/open-dis-java/blob/master/src/main/java/edu/nps/moves/dis/SetDataPdu.java
- The Java SetDataPdu unit test - https://github.com/open-dis/open-dis-java/blob/master/src/test/java/edu/nps/moves/dis/SetDataPduTest.java
@leif81 I will take definitively a look into it, I am working on a fork repo to fix those issues. So as soon I have terminated the development I will get in touch with you to let review my changes.
@leif81 I would just like to inform you, that I have started again to work on the Open-dis-cpp about aligning the DIS7 PDU with the IEEE Std 1278.1-2012 specification. I have switched, until now, to another project so sorry for the late delay. I have some working code for the SetData, StartResume and StopFreeze Pdu, as soon as I will do some code cleanup i will share my work on the forked repo