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

DIS7 - SetDataPdu - Access to _variableDatums #71

Open
quonn77 opened this issue Jul 19, 2022 · 4 comments
Open

DIS7 - SetDataPdu - Access to _variableDatums #71

quonn77 opened this issue Jul 19, 2022 · 4 comments

Comments

@quonn77
Copy link

quonn77 commented Jul 19, 2022

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 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

@quonn77
Copy link
Author

quonn77 commented Jul 27, 2022

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.

@leif81
Copy link
Member

leif81 commented Jul 28, 2022

@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.

  1. The C++ SetDataPdu class - https://github.com/open-dis/open-dis-cpp/blob/master/src/dis6/SetDataPdu.cpp
  2. The Java SetDataPdu class - https://github.com/open-dis/open-dis-java/blob/master/src/main/java/edu/nps/moves/dis/SetDataPdu.java
  3. The Java SetDataPdu unit test - https://github.com/open-dis/open-dis-java/blob/master/src/test/java/edu/nps/moves/dis/SetDataPduTest.java

@quonn77
Copy link
Author

quonn77 commented Jul 28, 2022

@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.

@quonn77
Copy link
Author

quonn77 commented Nov 11, 2022

@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

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

No branches or pull requests

2 participants