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. StartResumePDU, StopFreezePDU: Error in marshal and unmarshal methods #96

Open
eTrilles opened this issue Mar 26, 2024 · 1 comment

Comments

@eTrilles
Copy link

Hi.

The following methods:

virtual void marshal(DataStream& dataStream) const;
virtual void unmarshal(DataStream& dataStream);

In both classes: StartResumePdu and StopFreezePdu for DIS7, are processing twice the fields OriginatingEntityID and ReceivingEntityID.

The correct implementation for these methods should be something like this:

void StopFreezePdu::marshal(DataStream& dataStream) const
{
    SimulationManagementFamilyPdu::marshal(dataStream); // Marshal information in superclass first
    _realWorldTime.marshal(dataStream);
    dataStream << _reason;
    dataStream << _frozenBehavior;
    dataStream << _padding1;
    dataStream << _requestID;
}

void StopFreezePdu::unmarshal(DataStream& dataStream)
{
    SimulationManagementFamilyPdu::unmarshal(dataStream); // unmarshal information in superclass first
    _realWorldTime.unmarshal(dataStream);
    dataStream >> _reason;
    dataStream >> _frozenBehavior;
    dataStream >> _padding1;
    dataStream >> _requestID;
}

Also, these attributes:

/** Identifier for originating entity(or simulation) */
EntityID _originatingID; 

/** Identifier for the receiving entity(or simulation) */
EntityID _receivingID; 

Are not needed as they are already found in the parent class SimulationManagementFamilyPdu. Removing these duplicated attributes affect several other methods of both classes.

@leif81
Copy link
Member

leif81 commented Mar 26, 2024

Thanks @eTrilles . Would you like to submit a pull request for the proposed change?

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

No branches or pull requests

2 participants